Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello,
I have a situation where data are read from a source that always stores them in imperial units. All widgets in the project need to have the ability to be universally switchable such that they can show the converted values for metric and also the appropriate units at runtime. Any ideas?
Solved! Go to Solution.
There are a few ways you could handle this. Of course you will need a reference to conversion values. This could be pretty much any source, DataTable, Infotable Property (since there won't be too many rows) or even a external web service that can return the values.
I would then create a simple service to pass in a value (or a table of values) and return the same value (or table) in the new units.
The next step would be when to convert the values. This could be in each individual service that gets the data and prior to returning it to the mashup wrap the service to call the conversion service for each value. This is the simplest but would make your query run every time a new unit was selected.
Another option is to actually put the service on the mashup side in a function and pass each value through that based on what is selected. This would be a bit a painful to setup and maintain but would be less time hitting the data source. You would also need to query and return the conversion table into a mashup parameter (or keep it in a global session parameter) so it was always accessible via the script function.
There are a few ways you could handle this. Of course you will need a reference to conversion values. This could be pretty much any source, DataTable, Infotable Property (since there won't be too many rows) or even a external web service that can return the values.
I would then create a simple service to pass in a value (or a table of values) and return the same value (or table) in the new units.
The next step would be when to convert the values. This could be in each individual service that gets the data and prior to returning it to the mashup wrap the service to call the conversion service for each value. This is the simplest but would make your query run every time a new unit was selected.
Another option is to actually put the service on the mashup side in a function and pass each value through that based on what is selected. This would be a bit a painful to setup and maintain but would be less time hitting the data source. You would also need to query and return the conversion table into a mashup parameter (or keep it in a global session parameter) so it was always accessible via the script function.
Thanks, Adam. I'll poke around with your suggestions.
Hi @reengle.
If you found the previous post helpful, please mark it as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon