Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Persistent global variables in LiveCycle ES4

Avatar

Former Community Member

Due to a very specific customer requirement, the newly created LiveCycle PDF has to have the ability to import multiple XML files without losing any data.

This is the procedure that is implemented now:

  1. User opens PDF and imports XML file
  2. Internal function is called to parse the data from the imported fields
  3. Parsed data gets written into a global variable

The above procedure is running fine. However, when the user imports another XML the whole form gets resetted and even the global variables are empty again.

Here is the import code:


var vImport, vImportData, vImportXML;


try {


    vImport = util.stringFromStream(vStream).replace(/(\<\?.*\?\>\s*)|(\<!-{2}(.|\n|\r)*-{2}\>)|(\r\n|\r|\n)/g, "");


    vImportData = eval(vImport);


    vImportXML = vImportData.toXMLString();



    xfa.datasets.data.loadXML(vImportXML, false, true);


    xfa.form.recalculate(1);


    return true;


} catch (e) {


    return false;


}


I tried to remove the recalculate, I tried it with remerge but nothing worked.

Has anyone a suggestion?

Thanks!

0 Replies