10.02.2020, 18:11 | #1 |
Участник
|
crmtipoftheday: Tip #1321: Formatting currency values in Power Apps portals
Источник: https://crmtipoftheday.com/1321/form...-apps-portals/
============== Dollars are dollars are dollars. Until they’re not. I’ve been working on the portal implementation where pricing can look like this: (Those are UAE Dirhams, if you must know)Forms seem to be fine but any custom layout, uhm, is suddenly very challenging. I can get values without any issues but can’t format them for display. Before long, an SOS is sent: Folks, can’t figure out how to get formatted values from fetchxml in liquid. Is it possible at all?Mighty portallers like Nick Doelman, Colin Vermander, and Andrew Butenko chimed in. Redacted list of their suggestions:
format: format, [culture] Takes a format string and an optional culture, making it possible to write something like: My income is {{ 12345.005 | format: "C", "en-US" }} before tax. When I grow up and move to south of France, I will earn {{ 67890.049 | format: "C", "fr-FR" }} per week.Which produces a nice but totally fictitious statement: My income is $12,345.00 before tax. When I grow up and move to south of France, I will earn 67 890,05 € per week.currency: entity, attribute, [format] Format is great but still leaves us with the task of figuring out the currency of the record, etc. Enter currency filter that “formats a given numeric value according to the CRM currency settings for a given record and entity attribute”. Easier to demonstrate: {% assign q = entities.quote[params['id']] %} The quote total value is {{ q['totalamount'] | currency: q, "totalamount" }}That produces something like The quote total value is £1,234,567.89The other useful currency and decimal filters include: basecurrency: [format] Formats a given numeric value as representing a value in the organization base currency. invariantculturedecimalvalue: decimals Returns the unformatted/culture invariant value for a decimal number up to a specified number of decimal places maxdecimals: decimals, [culture] Formats a decimal number using specified number of decimals and culture. Strips out trailing zeros and the decimal separator if possible. decimals: decimals, [culture] Formats a decimal number using specified number of decimals and culture. Cover photo by Disha Sheta from Pexels Источник: https://crmtipoftheday.com/1321/form...-apps-portals/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|