I'm trying to set the value of a field that was dynamically added as part of a table section and I can't figure out how.
The table section is added by clicking on a button and that works just fine. I can access any field value in the table section that has the instance '0'. But I can't seem to figure out how to access field values from any other instances of this table section.
Here's the hierarchy of one of the fields:
TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection.Row8.dteFormedDateDevMem
Where 'MemberSection' is the section of rows the button will add an instance of. Now, I can access the value of the date field for the first instance of 'MemberSection' with the following:
DeveloperIdentityTbl.MemberSection.Row8.dteFormedDateDevMem.rawValue
If I want to do the same thing say for the 3rd instance of the 'MemberSection', how would I do that?
Thanks for the help!!
Marc
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
WhyIsThisMe is correct. You must reference the instance of the repeating 'MemberSection' by its index. Otherwise (as you have found) it defaults to the 1st instance. Sounds easy, right? Well...
Truth be told, this will depend on the scripting language you have chosen. The actual refernce syntax used for formCalc and javaScript is considerably different.
WhyIsThisMe's reference:
TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[2].Row8.dteFormedDateDevMem
should work for formCalc, but it won't for javaScript. For that you would need to use resolveNode()
/////////////////////////////////////////////
var indx = 2; // you probably will be selecting a differnt row under different circumstances, right? So, assign the index value to a variable
or instead
var indx = 0;
if(condition){indx= 2;}
else if(condition){indx= 3;} //you get the idea
////////////////////////////////////////////
//then you would do the assigning the value using resolveNode() by building the string that goes inside the ():
xfa.resolveNode("TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[" + indx + "].Row8.dteFormedDateDevMem").rawValue
/////////////////////////////////////////////
//you're building a string in javaScript, so the + is used. There are 3 parts to the final string for the resolveNode(). finalString = "part1" + indx + "part3"
//////////////////////////////////////////// Still with me? I usually opt for formCalc when referencing instances, since it is generally more forgiving
// In formCalc, 1st assign an index value to variable.
var indx = 0;
if(condition)then
indx= 2
elseif(condition)then
indx= 3 //you get the idea
endif
// then, use that variable to reference the instance of 'MemberSection' //resolveNode() not needed in formCalc
TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[indx].Row8.dteFormedDateDevMem
////////////////////////////////////////
Good luck!
Stephen
Views
Replies
Total Likes
If MemberSection is the row that you are adding instances of then you will need to reference the instance of that by adding an index to it like this:
TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[0].Row8.dteFormedDateDevMem
so the third instance of this row will be :
TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[2].Row8.dteFormedDateDevMem
(you may not need the whole reference before MemberSection - that depends on your script)
Views
Replies
Total Likes
Hi,
WhyIsThisMe is correct. You must reference the instance of the repeating 'MemberSection' by its index. Otherwise (as you have found) it defaults to the 1st instance. Sounds easy, right? Well...
Truth be told, this will depend on the scripting language you have chosen. The actual refernce syntax used for formCalc and javaScript is considerably different.
WhyIsThisMe's reference:
TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[2].Row8.dteFormedDateDevMem
should work for formCalc, but it won't for javaScript. For that you would need to use resolveNode()
/////////////////////////////////////////////
var indx = 2; // you probably will be selecting a differnt row under different circumstances, right? So, assign the index value to a variable
or instead
var indx = 0;
if(condition){indx= 2;}
else if(condition){indx= 3;} //you get the idea
////////////////////////////////////////////
//then you would do the assigning the value using resolveNode() by building the string that goes inside the ():
xfa.resolveNode("TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[" + indx + "].Row8.dteFormedDateDevMem").rawValue
/////////////////////////////////////////////
//you're building a string in javaScript, so the + is used. There are 3 parts to the final string for the resolveNode(). finalString = "part1" + indx + "part3"
//////////////////////////////////////////// Still with me? I usually opt for formCalc when referencing instances, since it is generally more forgiving
// In formCalc, 1st assign an index value to variable.
var indx = 0;
if(condition)then
indx= 2
elseif(condition)then
indx= 3 //you get the idea
endif
// then, use that variable to reference the instance of 'MemberSection' //resolveNode() not needed in formCalc
TopmostSubform.Page4.DeveloperIdSubform.DeveloperIdentityTbl.MemberSection[indx].Row8.dteFormedDateDevMem
////////////////////////////////////////
Good luck!
Stephen
Views
Replies
Total Likes
Thanks to both of you!
Stephen, your added explanation is much appreciated as this is the distinction I was missing: I was in Javascript using the formCalc construct. All is as it should be now.
Thanks again!
Marc
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies