Persistent global variables in LiveCycle ES4

floydein

08-06-2015

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!

Accepted Solutions (0)

Answers (0)