cancel
Showing results for 
Search instead for 
Did you mean: 

capturing context current context element values in script of subform

Former Member
0 Kudos

Hi,

Background:

Here are a few statements I would request you to consider in order to get the background of my problem and thereby you should be able to understand my problem and propose solution.

1. I am able to set the properties of UI Field in subform using the script of subform ( initialize event).

2. I have now tried to populate the values of subform bound context node ( cardinatlity 0..n).

The context element contains attribute values which will set property of UI Element.

3. The subform works like a table row and repeats according to number of context node elements. This is also happening.

4.I tried to find if each individual context node element is being accessed in subform. So i created test UI elements which will display what is populated in the context element. I did this and each subform(like a row in this scenario) is able to show that element values of that row. For example for 3 context elements, the subform repeats 3 times and each subform's test UI Element show the value of that context element

Problem

So far so good, but here was the problem area.

I went into the script area removed the statically set property of ui element. In this case the property is presence and mapped it to the context element attribute. Now what happens is that it always takes up the context element values of only the first element for all subforms.

The script code is like this

Circle1.presence = $record.testnode[*].vis1;

vis1 is the context element attribute and test node is the node with cardinality of 0..n which ensures that subform repeats.

Circle1 is the UI Element whose property has to be set.

Context node element 1 has vis value "visible"

element 2 has vis value "invisible" and so on.

What is happening is all subforms have their circles visible.

Same thing happens when I try with position x and y coordinates. All the subforms have same x and y displayment, the values of x and y displacement of first context element from the beginning of that subform instance.

How should I be able to capture the instance value of each context node element in the script area

Thanks,

Harish

Edited by: HARISH PALAMADAI SUBRAMANIAN on May 13, 2010 4:11 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

OttoGold
Active Contributor
0 Kudos

Circle1.presence = $record.testnode[*].vis1;

In your "code" I cannot see any row number. That means the same code can be found for Circle2, right? If you would add the index or something, then it could work for you, I guess. Otto

Former Member
0 Kudos

Yes that was just what I had tried as well. Does not seem to work.

Have issued a more circuitous method now though. Captured the attribute value in an invisible field and retrieved the field value in script instead of trying to read context attribute directly in script.

Any help in this matter highly appreciated. I am not liking to have to create more fields unncessarily

Thanks,

Harish

OttoGold
Active Contributor
0 Kudos

It should suffice to use the binding string of the hidden field in your script. Also check the value is the one, accepted by the property "presence". Otto