Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Filling a form based on a Table

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

30-08-2013

Good Afternoon,

I have a 2 page form that I am creating.

The first page is a timesheet. It has 2 fields of interest which are both repeated in a table with 15 rows:

The first field is named "Date1". This field contains the day of the month (ex. 1, 2, 3...)

form1.subform[1].Table1[0].Row1.Date1

The second field is named "amIN". In this field, the employee will enter the time they started their shift. (ex. 08:00)

form1.subform[1].Table1[0].Row1.amIN

The second page will have fields where the employee will enter their activity for that particular day. These entries will contained 15 in fields named "DayofMonth[*]. Specifically, I want a script for a field on the second page, called "Dayof Month1" to populate the value of "Date1" ONLY if "amIN" is not null.

If Row1.amIN is null, then I want the script to look to Row2.amIN. If it is null, then I want it to look to Row3.amIN, etc. I want it to scan each row for the first amIN that contains a value, and populate the corresponding value from the "Date" field into "DayofMonth1". Then I want it to continue to populate from the next amIN that has a value into "DayofMonth2", etc.

I am probably not explaining this very well, but I hope someone can make sense of it.

thanks!!!

Gene-O

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
Gene--O
Level 2

Likes

3 likes

Total Posts

76 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 3
Boost 1
View profile
Gene--O
Level 2

09-09-2013

thanks for the reply, I'll give it a shot!!!

Avatar

31-08-2013

My table is on page 3. Fields to be filled in are on page 4.

In page 4 calculate event:

var myVal;

var count = form1.pag3.sub3.Table3.Row1.all;

for (var i=0; i<count.length; i++) {

  myVal = xfa.resolveNode("form1.pag3.sub3.Table3.Row1["+i+"].amIN").rawValue;

  if (myVal) {

  myVal = xfa.resolveNode("form1.pag3.sub3.Table3.Row1["+i+"].Date1").rawValue;

  fillIn(i, myVal);

  }

}

function fillIn(i, myVal) {

  var myFldToSet;

  var count = form1.pag4.sub4.DayofMonth.all;

  for (var j=0; j<count.length; j++) {

  myFldToSet = xfa.resolveNode("form1.pag4.sub4.DayofMonth["+j+"]");

  if (j == i) {

  myFldToSet.rawValue = myVal;

  }

  }

}

In page 3 validate event:

xfa.form.form1.pag4.execCalculate();

it should work if you properly adapt names to your conventions.

Let me know.