How can i fix this problem?

 

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

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

mvp_badge
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!

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)

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

mvp_badge
MVP

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

mvp_badge
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.

Hi gaetano cerciello,

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

Regards,

Ellakkiya.S

currency


mvp_badge
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!

Hi gaetano cerciello,

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

Regards,

Ellakkiya.S

Why does it give me an error?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.