Expression Evaluation Time: ms / Round trip: ms
How to build a currency converter with MatchPoint
15. Aug
by Stefan Category:

In this blog post I'll show you how to build a currency converter with MatchPoint. All we need is a MatchPoint Form Web Part, a MatchPoint Composite Web Part and access to a currency converter web service. In this example we'll use the web service provided by WebServiceEx (

This web service takes two currency codes as input and returns the conversion rate. We use the Form Web Part to provide the input values. The Composite Web Part accesses these values via the Connection Framework, passes them to the web service and displays the results.

Form Web Part

The Form Web Part configuration is quite simple. It consists of two Choice Fields which provide the currencies that you can choose from. We assume the available currencies and the corresponding codes are stored in a SharePoint list Currencies. We use this list as a source for the Choice Fields. However, the values could come from other sources like a database, another web service, etc.

  1. Open the configuration and select the node Fields.
  2. Add a ChoiceField and set the Name to "From".
  3. Add a SPListChoiceProvider and set the ListUrl to the currencies list.
  4. Set the KeyColumn to the column on the list where the currency code is stored.
  5. Set the TextColumn to a descriptive column if available. Otherwise just use the same as in the KeyColumn.
  6. Add a second ChoiceField with the same configuration and set the Name to "To".

Composite Web Part

The Composite Web Part uses an Expression Data Provider to call the web service. In order for this to work we use the method CallWebService provided by the Expression Variable WSUtility. This method is able to build a proxy object on the fly if the web service provides a description in WSDL. This proxy exposes all methods that are defined by the web service. This makes using the web service easy, since the web service calls are like any other expression method calls:

  .DoSomething(withThat, andThat)

The currency converter web service provides a method ConversionRate(fromCode, toCode). This method takes currency codes as input. We now need to write an expression that calls the conversion method with the values selected in the Choice Fields on the Form Web Part. Cross Web Part communication is done with the Connection Framework. We can access the selected values in our Choice Fields with the expression ConnectionData.From and ConnectionData.To. This is where From and To correspond to the names of the fields. Choice Fields always provide their values as arrays of IChoiceItem: Therefore, to access the currency code we have to extract the Key of the first choice item:


The final expression of the ExpressionDataProvider looks like this:


This expression will throw an exception if no currencies are selected. Thus we set the IgnoreErrors flag to true in order to return an empty result set on error.

To display our results we add a PatternTransformer to the Composite Web Part. In the RowTemplate we can access the conversion results via the expression variable DataItem:

  1 {ConnectionData.From.First().Key} 
  {DataItem} {ConnectionData.To.First().Key}

This is what it looks in the end:

what it looks like


This blog is about technical and non-technical aspects of the product MatchPoint and other SharePoint topics.

If you would like to post an article or if you have an idea for a post, please contact us.

Matthias Weibel
09.04.2018 01:12
Link is updated and works now. | Goto Post
09.04.2018 12:21
Link doesn't work. Could anyone explain what does... | Goto Post
14.03.2018 02:05
Hi Markus
We I use the config for SiteCollectionSe... | Goto Post
Reto Jeger
04.10.2017 09:15
Hello Reiner,
Thanks for pointing out the missing ... | Goto Post
29.09.2017 09:56
Hi, I downloaded the ZIP-file for MatchPoint Versi... | Goto Post