# Using Mathematical conversion in aggregate editor

I am trying to use to the aggregate editor to calculate certain data. For example, i want to convert currencies, from USD to Euro. So in the aggregate editor, i have a vertical row of prices in USD and i want to convert it to Euro in the next column. How do i input the conversion in the aggregate editor?

Hi Jolene,

can you elaborate more like what you would like to input because you can find the below screen shot where you can easily pass the values like local variable, etc:

Solution

Hi Jolene,

You can create a calculated column. For that, click the "+ New Attribute" link at the the end of the column list of the preview:

A new Attribute will appear:

Click the "Attribute1" label to change the name. Then, double click the "fx" to open the Expression Editor for the column (alternatively, click the down arrow that appears when hovering the Attribute, and select "Edit forumula...").

Assuming you have both an Entity with a USD price, and an Entity with the conversion rate in EUR, you could create a formula like "Item.UsdPrice * ConversionRate.Rate" (or whatever the Entities and Attributes are called, of course).

The new Attribute will appear as AggregateName.List.Current.AttributeName when you want to use it.

Solution

Manish Jawla wrote:

Hi Jolene,

can you elaborate more like what you would like to input because you can find the below screen shot where you can easily pass the values like local variable, etc:

Hi Manish,

So i have prices in my database that are in USD. I want to convert the prices into Euro. How do i input the conversion rate in the editor?

Hi Jolene,

I just told you how to do it. Or is this not what you mean?

Jolene Kwek wrote:

Manish Jawla wrote:

Hi Jolene,

can you elaborate more like what you would like to input because you can find the below screen shot where you can easily pass the values like local variable, etc:

Hi Manish,

So i have prices in my database that are in USD. I want to convert the prices into Euro. How do i input the conversion rate in the editor?

HI Jolene,

you can create a local variable and use it in new calculated attribute, you can create a site property or action where you can define the conversion rate and assign it to your variable in preparation. please find the below screenshot for reference.

Kilian Hekhuis wrote:

Hi Jolene,

I just told you how to do it. Or is this not what you mean?

Hi Kilian,

Sorry my forum didn't refresh. I will go try it out, thanks for your help.

Manish Jawla wrote:

Jolene Kwek wrote:

Manish Jawla wrote:

Hi Jolene,

can you elaborate more like what you would like to input because you can find the below screen shot where you can easily pass the values like local variable, etc:

Hi Manish,

So i have prices in my database that are in USD. I want to convert the prices into Euro. How do i input the conversion rate in the editor?

HI Jolene,

you can create a local variable and use it in new calculated attribute, you can create a site property or action where you can define the conversion rate and assign it to your variable in preparation. please find the below screenshot for reference.

Hi Manish,

Alright i will go try it out. Thanks for the help.

Kilian Hekhuis wrote:

Hi Jolene,

You can create a calculated column. For that, click the "+ New Attribute" link at the the end of the column list of the preview:

A new Attribute will appear:

Click the "Attribute1" label to change the name. Then, double click the "fx" to open the Expression Editor for the column (alternatively, click the down arrow that appears when hovering the Attribute, and select "Edit forumula...").

Assuming you have both an Entity with a USD price, and an Entity with the conversion rate in EUR, you could create a formula like "Item.UsdPrice * ConversionRate.Rate" (or whatever the Entities and Attributes are called, of course).

The new Attribute will appear as AggregateName.List.Current.AttributeName when you want to use it.

Hi Kilian,

I did as you said but the calculated data returns as zero. My expression in the Expression Editor is as follows.

SyntaxEditor Code Snippet

`Price * GetConversionRatesToSGDS.List.Current.ConversionRatesToSGD.EuroRate`

Hi Jolene,

If the outcome is zero then either the Price was zero or the GetConversionRatesToSGDS.List.Current.ConversionRatesToSGD.EuroRate was zero. I'm assuming you can see that Price isn't zero, so I have to ask, when does this GetConversionRatesToSGDS aggregate get called, and how do you know that .List.Current will hold the right conversion rate to SGD?

Can you show us the code snippet (screenshot of your screen action) with the logic until the aggregate that needs currency conversion)?

Cheers

Jorge Martins wrote:

Hi Jolene,

If the outcome is zero then either the Price was zero or the GetConversionRatesToSGDS.List.Current.ConversionRatesToSGD.EuroRate was zero. I'm assuming you can see that Price isn't zero, so I have to ask, when does this GetConversionRatesToSGDS aggregate get called, and how do you know that .List.Current will hold the right conversion rate to SGD?

Can you show us the code snippet (screenshot of your screen action) with the logic until the aggregate that needs currency conversion)?

Cheers

Hi Jorge,

Turns out it was my mistake!! Thanks for your help anyways!