Expand my Community achievements bar.

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

How to set a field in the xml data from a script?

Avatar

Level 2

Hi,

I want to set a modified flag in the xml data when a field is modified. I added a field for that in the xsd that is bound to the pdf file:

<xs:element name="modifiedFields">

     <xs:complexType>

          <xs:sequence>

               <xs:element name="countryModified" type="xs:int"/>

          </xs:sequence>

     </xs:complexType>

</xs:element>

And I want to access it when a change event occurs:

salesReport.Page1.ProductNameTableSubForm.ProductNameTable.Row1.country::change - (JavaScript, client)

countryModified = 1;                              // does not work

$.modifiedFields.countryModified = 1;     // does not work

There is no field in the pdf that is bound to countryModified. How can I set the value of the countryModified field without having a field bound to that?

Thanks in advance for your help.

Cheers,

Arne

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Without seeing the entire xml structure I cannot give you the exact syntax but it would be something like this:

xfa.datasets.data.modifiedFields.countryModified.value  = 1

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Without seeing the entire xml structure I cannot give you the exact syntax but it would be something like this:

xfa.datasets.data.modifiedFields.countryModified.value  = 1

Paul

Avatar

Level 2

Hi Paul,

thank you very much for that, it works now. It took me some time to realize that this is actually FormCalc and not Javascript (Doh!), though.

Thanks again for your help, I really appreciate that.

Cheers,

Arne

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----