• Dave Wakeman
    July 24, 2015 at 11:39 am #494

    When I work with formulas I know the syntax to reference data by using a control id, but I have found a situation where it doesn’t seem to work correctly.  Imagine that I have a vertical layout with some controls in it and I have it bound to a list.  Inside of the Vertical Layout I have 4 controls whose control Ids are:

    • Name
    • PartNumber
    • UnitPrice
    • Description

    If I want to tweak the text in PartNumber I can do something like this: “Part Number: ” + me.getValue() and it will display something like this:     Part Number: 55484938

    In my case, I am talking about a price, which is of type decimal, and I want to use an Output Text control so that all I see on my coach is the value.  With an Integer control I always get the shape of the box around the value, even when it is set to Read Only, and that’s not the behavior I want.  I like the style of the Output Text but I can’t bind a variable that is of type Decimal to it.  The formula I am trying to use is:  “$” + ${UnitPrice).getData() so that I get my prices to show up with the dollar sign in front.

    To work around this issue I just made my decimal field with visibility set to None, and have an Output Text control with a formula that references the decimal control named UnitPrice.

    This works for the first one in the list, but when I looked at the HTML that got generated, the control ID of all 7 controls that hold the price are the same.  Therefore, I get the same value in all 7 of my output text controls that have the formula that references the decimal control by control Id.

    Has anybody else experienced this issue, and if so, are there any workarounds available?


    Rex Townsend
    July 25, 2015 at 9:22 pm #496


    I was able to replicate the problem you’re having and have come up with a workaround that should address your needs.

    For your reference, here’s an object I made to test this workaround.


    As you specified in your post, I set up a Vertical Layout bound to the repeating object in the screenshot above. For Unit Price, instead of putting a Decimal Control inside the Vertical Layout, I used an Output Text. The caveat here is that you have to uncheck the box to “Use matching variables only”, drill into “currentItem” and then select your unitPrice parameter. You’ll get a yellow exclamation mark warning next to the binding indicating that the variable types don’t match, but it still works fine! This should also alleviate the need for you to use the hidden Decimal control you have currently.

    The final step is to add some On Load code to the Output Text bound to the Unit Price (Decimal) parameter.

    me.setText(“$” + me.getData())

    After that, go ahead and run it and see what you get. These are my results:

    Hope this works for you. Keep us posted.

    Dave Wakeman
    July 26, 2015 at 6:36 pm #499

    Yep, that worked great.  I was using the Text Formula field rather than the On Load event, thinking that they would behave the same, but as long as I can get it to work I won’t be too picky!  🙂

    Thanks for your help!

    – Dave

    July 31, 2015 at 9:56 am #545

    Hey Dave,

    I think it is also worth mentioning that there is an alternative way to accomplish the Output Text “look” with a Decimal or Integer control inside of the Table control. If you were to use a Table instead of a repeating Vertical Layout you could make use of the Columns configuration option to set the desired columns to display as Simple HTML. By displaying a column as Simple HTML, you will will view the decimal text as read-only without any bordering.

    Within the Columns Options section you can add : “decimalPlaces”: 2, “decimalSeparator”: “.”, “thousandsSeparator”: “,”, “prefix”: “$”

    *Note that each row in Column Option corresponds to the control in the table , so in this example:

    • 1 = Item table column (String)
    • 2 = Price table column (Decimal)

    See attached images to view both the Column configuration options, and the resulting table after the changes.

    -Elliot P

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search