1
0
-1

Hi,

I have a currency field in a Maestro form.

When I enter a value that has no cents, such as 99, the display shown in the form is '99.00', but the value in the form xml is '99', and then when I use that value in a Velocity template it ends up as '99'.

However, if I enter a value that has cents, such as 10.99, the display shows '10.99' and the form xml shows '10.99' and the value in the velocity template shows '10.99'.

Is it possible to format or configure the currency field so that the value in the form xml is '99.00' including the cents, so that when the value is used in a velocity template it displays as a formatted currency?

I could manipulate the values either before feeding them to the velocity template or add conditional statements in the template, but that seems tedious and time consuming, and a lot of work to maintain. I would prefer to have the values presented as formatted values in the form xml.

Thanks

Mark

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Mark,

      You could uncheck 'Include in Submission Data' for your currency field, and add a data field to your form with 'Include in Submission Data' checked.

      Then add a calculation rule to the data field like:

          angular.module(['app']).injector.get('currencyFilter')(data.currencyField)

      This will format the data field to currency and pass it in the form XML.

      1. Mark Murray

        Hi Bill,

        great suggestion, but lots of work for me to do. There are quite a few currency fields on the page, so I will need to retrofit this to them all.

        I did that and got this working; in the end I actually used the 'numberFilter' and formatted the number to two decimal places, and that gave me what I needed - I need to format the currency symbol and the actual amount separately.

        The currency field has some options for decimal separator and number of decimal places; these options appear to only influence the display of the value in the form field and not affect the underlying data - it would be a nice feature if the options could influence the data, so that the output reflects to same as the display. But that may be something for the product team to consider, and whether that would work for all users/scenarios.

        Thanks

        Mark

      CommentAdd your comment...