add counter in addInstance

Avatar

21-11-2008

Hi,



I have create a sub form with an addInstance-feature. I also added a textbox and a numeric field. The text says Journey and the mumeric field is empty, but has a script to add +1. The result in the PDF is Journey 1 as title. When I click the + button, the new sub form gets the name Journey 2.



The result is Journey 3 - Journey 2 then Journey 1 while it has to be journey 1 - journey 2 -journey 3



Can anyone help to get this in the correct order? Or is there another way to add a counter in a title?



The code I use now in FormCalc is:



Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson.fldPerson[*] = Sum(Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson.fldPerson.rawValue + 1)

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

21-11-2008

Are you trying to get unique names for each of your fields in the repeating subform?



When you add an Instance of a subform it is the subform that gets the occurance number not the field ..... so in your above example if you have 3 occurances you woud have:



Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson[0].fldPerson

Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson[1].fldPerson

Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson[2].fldPerson



That makes each occurance of fldPerson unique and by knowing the subform ocurance you know which row it belongs to.

Avatar

24-11-2008

Paul,



I don't realy understand what you mean!



My goal is when I click the button the form should give me the title journey1 for the first, then i fill in the fields and when I click again he would need to give me Journey 2 for the second one which would be new empty fields. Now I have Journey 1 for the new added subform which is empty and journey 2 for the subform I have filled in first.

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

24-11-2008

Hi Bjorn,



Paul is saying that how you are addressing the field is incorrect.



Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson.fldPerson[*]



This is addressing an array of fields called "fldPerson" on a subform, but actually there is no array of fields. Instead there is an array of subforms so you must use:



Incitant7.subVoyage.subVoyage.subVoyagePers.subButtonPerson[*].fldPerson



And I have no idea if "*" will work for addressing the fields.

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

24-11-2008

So is journey 1 and journey 2 a caption or an actual field name?