sending array using XML code to action sequence
Posted: Tue Jan 07, 2020 7:50 am
Hi Clifton,
Happy New Year!
Thanks once again for the brilliant XML system. If I had used it from the start maybe my project would have been finished years ago!
Here is my latest problem.
I store data in an array called PDetails. When the user has finished creating an exercise, the data in PDetails is transferred to a text file. PDetails contains 10 lines of comma separated values.
I use 3 files IT.tbk, Ex.tbk and IT1.tbk so 3 different windows in this part of my program: 'IT' (main window) and 'Ex' and 'IT1' which are loaded using pgGotoURL. 'IT' and 'IT1' use action sequences as I made them some time ago. 'Ex' uses code loaded by an XMl file. They all have a PDetails array and when PDetails is modified in one window the other 2 must have their PDetails array modified simultaneously. I have no problem transferring the PDetails array from IT to IT1 (both use action sequences and TB global variables) but I have not succeeded in transferring the PDetails array in 'Ex' which is stored as a 'make object property' to the other 2 windows. Here is part of the code:
<make id="sharedActions" type="div" level="0" dims="-50,-50,20,20" class="" refObj="sysbootstrap" autoAlign="" replace="">
<style>
{ "display" : "none" }
</style>
etc ...
//this.currentLine = tbfunction_pgSplitToArray(sharedActions2.PDetails[currentNo],",", true);!!
<function name="modifyCurrentLine" event="" params="itemNo,item">
<![CDATA[
this.currentLine[itemNo] = item;
var newLine = this.currentLine [1] + "," + this.currentLine [2] + "," + this.currentLine [3] + "," + this.currentLine [4] + ","
+ this.currentLine [5] + "," + this.currentLine [6] + "," + this.currentLine [7] + "," + this.currentLine [8] + "," + this.currentLine [9];
sharedActions2.PDetails[this.docNo] = newLine;
tbfunction_pgExecuteRemote("main", "tbfunction_pgTBObjSet" ["ML4", "user", sharedActions2.PDetails]);
]]>
</function>
</make>
The ML4 field in the main window does not seem to receive the sharedActions2.PDetails array. Can you suggest why please?
Thanks for your time.
John
UPDATE Just spotted the error! no comma after "tbfunction_pgTBObjSet" In the meantime I've been sending only the variable newLine to update the array in IT as the complete array did not need to be updated. So I still don't know if there was a real problem or not.
Happy New Year!
Thanks once again for the brilliant XML system. If I had used it from the start maybe my project would have been finished years ago!
Here is my latest problem.
I store data in an array called PDetails. When the user has finished creating an exercise, the data in PDetails is transferred to a text file. PDetails contains 10 lines of comma separated values.
I use 3 files IT.tbk, Ex.tbk and IT1.tbk so 3 different windows in this part of my program: 'IT' (main window) and 'Ex' and 'IT1' which are loaded using pgGotoURL. 'IT' and 'IT1' use action sequences as I made them some time ago. 'Ex' uses code loaded by an XMl file. They all have a PDetails array and when PDetails is modified in one window the other 2 must have their PDetails array modified simultaneously. I have no problem transferring the PDetails array from IT to IT1 (both use action sequences and TB global variables) but I have not succeeded in transferring the PDetails array in 'Ex' which is stored as a 'make object property' to the other 2 windows. Here is part of the code:
<make id="sharedActions" type="div" level="0" dims="-50,-50,20,20" class="" refObj="sysbootstrap" autoAlign="" replace="">
<style>
{ "display" : "none" }
</style>
etc ...
//this.currentLine = tbfunction_pgSplitToArray(sharedActions2.PDetails[currentNo],",", true);!!
<function name="modifyCurrentLine" event="" params="itemNo,item">
<![CDATA[
this.currentLine[itemNo] = item;
var newLine = this.currentLine [1] + "," + this.currentLine [2] + "," + this.currentLine [3] + "," + this.currentLine [4] + ","
+ this.currentLine [5] + "," + this.currentLine [6] + "," + this.currentLine [7] + "," + this.currentLine [8] + "," + this.currentLine [9];
sharedActions2.PDetails[this.docNo] = newLine;
tbfunction_pgExecuteRemote("main", "tbfunction_pgTBObjSet" ["ML4", "user", sharedActions2.PDetails]);
]]>
</function>
</make>
The ML4 field in the main window does not seem to receive the sharedActions2.PDetails array. Can you suggest why please?
Thanks for your time.
John
UPDATE Just spotted the error! no comma after "tbfunction_pgTBObjSet" In the meantime I've been sending only the variable newLine to update the array in IT as the complete array did not need to be updated. So I still don't know if there was a real problem or not.