351
Views
13
Comments
How can i fix this problem?

 

2021-04-17 09-53-48
José Gonçalves

FormatCurrency function returns a Text value and you assigned it to a Currency data type variable.

2023-03-21 16-59-35
Gaetano Cerciello

After conversion, the formatted value must go into a given currency type. How could I do it?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Gaetano,

That's not how it works. A currency is just a decimal value, it's a number. Formatting is something you do once you want it displayed.

Also, you are doing a TextToDecimal of TaxableIncome, but TaxableIncome should already be a Decimal or Currency!

2021-04-17 09-53-48
José Gonçalves

You cannot save in the database that formatted text as a currency.

You have several options:

  • save as Currency and whenever you want to display it, apply the FormatCurrency
  • in the database change the data type to text
  • create another column with the formatted Price in text (bad choice)
2023-03-21 16-59-35
Gaetano Cerciello

I put into the currency variable the value of my getinvoicebyid etc... variable, which is also of type currency.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Changing the database data type to text is also a pretty bad idea :D

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Gaetano,

I have to ask, do you have any programming experience? Because data type conversion is pretty basic programming stuff.

What the error says ("'Currency' data type required instead of 'Text') pertains to the Expression as a whole - if the error is about parts of the Expression, it underlines that part with squiggly lines.

So in this case, the error means that the result of the Expression is Text (which it is, FormatCurrency outputs Text), but you try to assign it to a variable of type Currency (outside the Expression editor), and that doesn't work.

UserImage.jpg
Ellakkiya

Hi gaetano cerciello,

Just need clarification, what is datatype of Taxable income attribute.

Regards,

Ellakkiya.S

2023-03-21 16-59-35
Gaetano Cerciello

currency


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

So in that case there's no need for a "TextToDecimal", as that doesn't make sense at all. Also, like I said, you cannot store a formatted currency in the database, that's not how it works!

UserImage.jpg
Ellakkiya

Hi gaetano cerciello,

As Kilian Hekhuis said, To format the currency no need of TextToDecimal  convertion.

Regards,

Ellakkiya.S

2023-03-21 16-59-35
Gaetano Cerciello

Why does it give me an error?

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.