Retrieve this.rawValue = this.parent.index + 1; for use elsewhere | Community
Skip to main content
New Participant
November 23, 2011
Question

Retrieve this.rawValue = this.parent.index + 1; for use elsewhere

  • November 23, 2011
  • 14 replies
  • 12716 views

I have yet another dumb question.  I have a subform with a field displaying the instance number for that form.  It is in layout:ready

this.rawValue = this.parent.index + 1;

How do I retrieve the value of that field for use elsewhere on the form?  I have tried getting the value as itemno.rawValue but it does not give me the rawValue.

Thanks,
Eagle

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

14 replies

Eagle0107Author
New Participant
November 24, 2011

OK let me try it this way.  I have a repeatable subform that has a number of user input items in it.  I have created a drop down on another page that is populated with content from the subform and all works well.  I can retreive any user input field value and populate the drop down.

One of the fields on the subform is ItemNo.  In the Layout:Ready event I have the formula this.rawValue = this.parent.index + 1; that displays the number of this repeating subform.

On another page I have the follwoing formula in the Enter event that returns the value of any field I identify in the subform EXCEPT the value of the ItemNo field. 

this.clearItems();
this.rawValue = null;
this.fontColor = "0,0,0";

var nCount = Subform3.Subform2.Subform1.instanceManager.count;
console.println("nCount: " + nCount);

for (var i=0; i<=nCount; i++)
{
var vFld = xfa.resolveNode("Subform3.Subform2.Subform1[" + i + "]");
var vItem = vFld.ItemNo.rawValue;
this.addItem(vItem);
}

What I am trying to figure out is why I cannot get the rawValue of the ItemNo field since it should set in the Layout:Reay event.

Thanks,

Eagle

Niall_O_Donovan
New Participant
November 24, 2011

Hi,

Dealing with repeating subforms is very similar/the same as dealing with repeating rows.

Have a look at the amended example here: http://assure.ly/rwvJxM. There is a dropdown added to the last Table (Table 6), which uses subforms.

Have a close look at the script in the preOpen event of the dropdown AND the click event of the delete row/subform button.

Hope that helps,

Niall

Eagle0107Author
New Participant
November 24, 2011

Once again I must be missing something.  I am not working with rows, I am working with repeating subforms that do not have rows.  I am simply trying to get the rawValue of the this.rawValue = this.parent.index + 1; field on the form.  Since the subform is repeating each one is numbered and I want to populate a drop down with the number of each subform so I can do some other things with that information.

Thanks,
Eagle

Niall_O_Donovan
New Participant
November 24, 2011

No problem!

The script in the layout:ready event will give a number for each row and will update as rows are added and deleted. Great!

Because the rows are repeating, which item number are you trying to access? If we take a situation where the table is called Table1 and the repeating row is called Row1.

The following JavaScript in the calculate event of another object would get the index number of the first repeating row (zero-based numbering system):

this.rawValue = xfa.resolveNode("Table1.Row1[0].itemno").rawValue;

We know that this would return 1.

If you want to work through the table until a criteria is met and then get that index number, then this would require a loop. Have a look at this example that explores how to reference objects: http://assure.ly/kUP02y.

Hope that helps,

Niall