cancel
Showing results for 
Search instead for 
Did you mean: 

Access Context attribute values

Former Member
0 Kudos

Hi,

My Context attribute structure is as follows -

Context

-<b>OrderRequest</b>

-item (which has item no ,qty ...)

- OrderHeader (order header attributes)

When I try to get the Item attribute values with

<b>wdContext.currentItemElement().getItemNumber()</b> - It always returns a null value .

<b>wdContext.currentItemElement().setItemNumber("10");</b> - This does not set the value either.

How do I access the sub elements - of <b>item</b> and <b>OrderHeader</b> nodes of the current context?

- Ashwini.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Ashwini,

Could you please give more info about your context structure: cardinality for nodes, singleton property for subnodes.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

wdContext.node<yourNode>.current<YourNode>Element()

Regards Mario

Former Member
0 Kudos

hi

Thanks for the help..but im still not able to access it.

My context is mapped to a model and it takes the node and elements defined in it.

Im not able to access the node context attributes from my code.

my context is like this:


NodeA
|-NodeB
   |-NodeC
      |-Item1
      |-Item2
      |-Item3

The properties for Context Node A are:

Cardinality : 0...n

Collection Type: list

initialleadselection:true

selection:0..1

singleton: true

typedaccessrequired: true

The properties of Node B are:

Cardinality : 0...1

Collection Type: list

initialleadselection:true

singleton: true

selection:0..1

typedaccessrequired: true

The properties of Node C are:

Cardinality : 0...n

Collection Type: list

initialleadselection:true

singleton: true

selection:0..1

typedaccessrequired: true

So I try to use this piece of code in my implementation class:

wdContext.NodeA().NodeB().NodeC().currentNodeCElement().getItem1();

I enter a value in the field and click on 'Go' button. It should pop up a confirmation dialog box showing me the value in the Item1 field.

When I click, it reurns me the value 'null'. why?

Thanks

Ashwini

Former Member
0 Kudos

The cardinality of your node C is 0:n. I believe you have not created an element before acceesing it.

Please try to create an element under the node i.e.

IPrivate<View>.I<Node>Element ele= wdcontext.createnodeCElement();

ele.setItem1(<value>);

wdcontext.nodeC.addElement(ele);

Please check the code for syntax. I hope this should solve your problem.

Noufal