how to get currency2 value without including the currency symbol

daikhi haithem
Tera Expert

Hello

i want to know how to get currency2 value without including the currency symbol

 

"EUR;10"

7 REPLIES 7

Well, if you use "current.price.getCurrencyValue()", you'd end up with 157000,00. Or you should end up with the same if you use "current.getValue("price")" depending on your session currency.

getCurrencyValue() returns the value in the original currency.
If you want it in your current currency, then use getValue. getDisplayValue might include the currency sign and "," so don't use it.



Now if you just want the numbers without the cents, you can do that by splitting the value into an array.
var newValue = value.split(".");
value = newValue[0]; //You end up with 157000.

daikhi haithem
Tera Expert

Great, thank you! 😉

And for setting a field, like I have in this example,

For the first field, this is working correctly for me:

current.fieldName.setDisplayValue('EUR;'+Variable);  

Is it the same thing for the second field?

 

coooooooooooo.png

The price is set based on your currency if you say, for example, current.price = 1000; and you're using euros it would become 1000€.
If you need to set it based on some other currency, you can say current.price = "USD;1000";

So in your case I'd assume using "USD;1000" in a script would set the field to 1000 USD and show it as some amount of EUR in your session.