I have been researching how to reference fields on spawned pages and have managed to successfully calculate values etc when the fields are on the same spawned page (using the split method based on "."). However, I'm having difficulty getting values from fields that are on separate pages, spawned from a different templates. Hopefully I can present the issue in a logical way....here goes:
I have 6 template pages which are spawned from a single user click of a button. These always spawn in order (1 - 6). On the first spawn these are prefixed P1 - P6 as I have a static title page which takes the place of P0. On the second spawn these would then be P7-P12.
The first three templates are named PreSurvey1, PreSurvey2 and PreSurvey3.
The final three templates are named PostSurvey1, PostSurvey2 and PostSurvey3
So, on the first spawn I get P1.PreSurvey1, P2.PreSurvey2, P3.PreSurvey3, P4.PostSurvey1, P5.PostSurvey2 and P6.PostSurvey3.
A number of text fields are present on each of these templates. For this example lets use the field 'TripNumber_TB'.
TripNumber_TB appears on both templates PreSurvey1 and PostSurvey1 and these are linked in the templates.
However, when spawned this link is broken due to the prefixes that are added. This is where I run into an issue as it is beyond a simple split, I need to change characters in the string.
The spawned field names now become:
P1.PreSurvey1.TripNumber_TB and P4.PostSurvey1.TripNumber_TB.
How do I go about splitting and editing the above names to correctly reference each other?
The difference between the P values will always be 3 and the template names will always remain the same even when spawned multiple times (for example on the second spawn it will be P7.PreSurvey1.TripNumber_TB and P10.PostSurvey1.TripNumber_TB.
Any help would be much appreciated!