Expand my Community achievements bar.

SOLVED

Caption Dynamic Property handling of variable data

Avatar

Level 7

I have a dynamic form containing a number of fields whose captions will vary based upon the data given to it. Say the data looks something like this:


<?xml version="1.0" encoding="UTF-8"?>


<Root>


   <Drinks>


      <Drink>


         <Name>Coke</Name>


      </Drink>


      <Drink>


         <Name>Pepsi</Name>


      </Drink>


      <Drink>


         <Name>RC Cola</Name>


      </Drink>


   </Drinks>


</Root>


I’ve attempted to set the caption of each field to the corresponding Name by using Dynamic Properties, $record.Drinks.Drink[*].Name in this case.

676532_pastedImage_11.png

The following is generated in the XML: <setProperty target="caption.value.#text" ref="$record.Drinks.Drink[*].Name"/>

But the result is that the all Captions are set to the same value, the first child node of Drinks (Coke).

A link to the PDF is here: https://files.acrobat.com/a/preview/987ba4fa-19e4-4e38-8147-a75c12daaa7c. You can import the above XML to reproduce the issue.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

It looks like Designer has got confused handling the repeating group, if you change the caption binding to "$.Name" it works.

The binding in the setProperty element should be relative to its parent (Drink in this case).

Seeing "$record" in the binding expression is something I always check as it seems to be added in when Designer wants to generate an expression outside of the current binding context, so $record is like a document level reference.  Even though the caption binding has a [*] in the reference the [*] in the Drink subform binding reference is what drives the layout, so resolves to the first Name.

Regards

Bruce

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

It looks like Designer has got confused handling the repeating group, if you change the caption binding to "$.Name" it works.

The binding in the setProperty element should be relative to its parent (Drink in this case).

Seeing "$record" in the binding expression is something I always check as it seems to be added in when Designer wants to generate an expression outside of the current binding context, so $record is like a document level reference.  Even though the caption binding has a [*] in the reference the [*] in the Drink subform binding reference is what drives the layout, so resolves to the first Name.

Regards

Bruce