Merge data from users into a single form?

MHWinter

26-01-2017

I created a dynamic pdf form in Livecycle Designer ES2.

It includes a repeating subform to capture information on problems detected during a site visit. Typically, during such site visits, there are multiple auditors and each may identify different problems.

At the end of the site cisit, a single list of all identified problems is generated.

Is there a way for each auditor to fill in a form and merge the data from all auditors into a single combined form?

I tried to export data from one user and import it into the form of the second user but it over-writes the information.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

MHWinter

26-01-2017

I am trying to use the xfa.host.import() function but something creates an error and I don't know what.

I created a button to (1) save the existing data in an array, (2) import new data, (3) create new instance of the subform and (4) paste the data from the array in the added instances.

But the script stops right after the import function.

If I import the data a first time in the form, I get the expected data. Then if I import other data, I get the new data but the old data are lost. If I run the script but cancel the import, then I get the data duplicated.

So what's wrong?

Here is the code I created:

var nNC = Mysubform.instanceManager.count;

var myNC_Ref = [];

for (var i = 0; i < nNC; i++){

    var sSubform = "Mysubform["+i+"]";

    myNC_Ref[i] = xfa.resolveNode(sSubform).Mydata.rawValue;

}

xfa.host.importData();

var nNewNC = Mysubform.instanceManager.count;

var nTotalNC = nNC + nNewNC;

Mysubform.instanceManager.setInstances(nTotalNC);

for (var i=0; i<nNC; i++){

    var j = nNewNC + i;

    var sSubform = "Mysubform["+j+"]";

    xfa.resolveNode(sSubform).Mydata.rawValue = myNC_Ref[i];

}

xfa.form.recalculate(1);