Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to handle xml Attributes?

Avatar

Level 1

Hallo,

I am new at Livecycle and I have some trouble to figure out how to read/bind XML attributes in LiveCycle Designer.

If I drag & drop elements (#data from Data View) they appear without problems. But if I drag&drop an attribute (@attributename) they always show up empty at the PDF.

For example I have a XML File that Looks like that:

<product>

....

         <price>

            <oldprice visible="true">

                <priceA visible="false">1.350,00</priceA>

                <priceB visible="true">1.350,00</priceB>

                <priceC visible="true">20,00</priceC>

                <priceD visible="false">0,00</priceD>

            </oldprice>

            <newprice visible="true">

                <priceA visible="false">1.350,00</priceA>

                <priceB visible="true">1.350,00</priceB>

                <priceC visible="true">20,00</priceC>

                <priceD visible="false">0,00</priceD>

            </sonderpreise>

          </price>

...

</product>

I tried to bind it like that: price.oldprice.(visible.value=="true").priceA but it does not work.

I can´t really find some good informations about handling XML Attribute in LiveCycle. Can someone please help me or tell me where to find more Information about that subject.

Thank you!!!

Regards Kat

1 Accepted Solution

Avatar

Correct answer by
Level 10

There is not relationship between the object presence property and your visible-attribute so far.

But you can use a script to create such thing.

Put this into the layout:Ready event of a text field you want to be hidden/shown depending on the visible-attributes value.


this.presence = this.dataNode.visible.value === "true" ? "visible" : "hidden";


View solution in original post

4 Replies

Avatar

Level 10

Hi,

not sure what you are doing wrong, it worked for me.

I created a data connection from a sample XML file as yours and then simply dragged the fields into the form.

As you can see there are also fields created which are bound to the visible-Attributes of the XML.

Data_Connection.png

Btw: The sample XML you used above is invalid because the there the closing tag of <newprice> is named <sonderpreise>.

Avatar

Level 1

Thank you for your answer.

The thing is when I create the PDF File I expecte the visible fields have true/false values, but they are empty.

What I basically whant to do is, when the visible attribute is false, to set the presence="hidden";

Avatar

Correct answer by
Level 10

There is not relationship between the object presence property and your visible-attribute so far.

But you can use a script to create such thing.

Put this into the layout:Ready event of a text field you want to be hidden/shown depending on the visible-attributes value.


this.presence = this.dataNode.visible.value === "true" ? "visible" : "hidden";


Avatar

Level 1

That helps a lot. Thank you very much!!!