cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to read attribute value

carlin_willams
Participant
0 Kudos

Hello Experts.

I have child WD component say u201CBu201D, in this created node (Name : B) with one attribute (Name : Test) and selected as interface node.In this component I am setting the value for attribute (Name : Test).

I have added above WD component u201CBu201D in the parent WD Component u201CAu201D as Used Webdynpro Component. So I got node (Name : B) in the component parent Component u201CAu201D.

When I am trying to read attribute (Name : Test) it is coming empty in Parent Component u201CAu201D.

I have verified all the binding and basic things everything looks fine but I am getting empty value in Parent Component u201CAu201D.

Thanks in Advance.

BR

- CW

Accepted Solutions (0)

Answers (2)

Answers (2)

saravanan_narayanan
Active Contributor
0 Kudos

hello Carlin,

did you initialise the child component in parent component? just wanted to confirm whether you have created the used component before accessing the context attribute.

Br, Saravanan

carlin_willams
Participant
0 Kudos

Hello

Sara : Yes i have intialized child component in the parent component.

Leka : I didn't get your question ....what exactly u r asking.

BR

-CW

Aisurya
Participant
0 Kudos

Hello ,

Have u used the component "B" , in the views of component "A" where u are using/reading it ?

Thanks

Aisurya

Former Member
0 Kudos

There is a property in context node level for INput element....Have you checked it or unchhecked it..can you check.

carlin_willams
Participant
0 Kudos

Hello

Have u used the component "B" , in the views of component "A" where u are using/reading it ? : Yes

The Input element of Node property set no mean unchecked.

BR

-CW

saravanan_narayanan
Active Contributor
0 Kudos

Hello Carlin,

how are you populating the value of Test in component B? is it via a separate method or is it populated in the INIT method of the component B.

If its done in the INIT method then you should get the value in Component A.

if its done in separate method then expose that method in Component B as interface method and in Component A after creating Component B, called the interface method of component B.

BR,

Saravanan

carlin_willams
Participant
0 Kudos

Hello Sara

Thanks for your reply.

My Scanario is like this.

Child Component Means "B" is Having 3 buttons on click of buttons stroring corresponding values in the attribute.

Example : Button1 click calling the method passing B1 to the set_attribute method where i am setting the value to attribute.

Button2 click calling the method passing B2 to the set_attribute method where i am setting the value to attribute.

Button3 click calling the method passing B3 to the set_attribute method where i am setting the value to attribute.

I want get the values above button values in the parent component.

Means i m writting custom method : set_attribute. I can expose this methos interface. What is next? Do i need to call this method from Component A?

Please guide me.

BR

-CW

Edited by: CarlinWilliams on Jun 29, 2011 8:59 AM

Former Member
0 Kudos

Yes, you need to call the method in Comp A to get the values...

Usually wecan directly read the interface node of B inside A to get the values...Or else we can create a method in Comp B to read that nodes values and later this method is called in Comp A. there are 2 ways of doing the same.

saravanan_narayanan
Active Contributor
0 Kudos

Hello Carlin,

I didnt quite get this statement

I want get the values above button values in the parent component.

What I understood is that in component B, you are calling SET_ATTRIBUTE method by passing B1 or B2 or B3 based on respective button click. this method in turn sets the value of the context attribute 'TEST'.

Now if you want to access TEST value, then as you mentioned you have to expose the method SET_ATTRIBUTE in Component B. then call this method from Component A and pass either B1 or B2 or B3 based on your requirement. But which value you need to pass to the B's->SET_ATTRIBUTE method that has to be sorted out by you based on your requirement.

After calling B's->SET_ATTRIBUTE method in Component A, the value populated in Context Attribute 'TEST' in B will also be available in Componet A's context.

Hope this helps.

BR, Saravanan

carlin_willams
Participant
0 Kudos

Hello Saravanan

You are correct

What I understood is that in component B, you are calling SET_ATTRIBUTE method by passing B1 or B2 or B3 based on respective button click. this method in turn sets the value of the context attribute 'TEST'.

I want to access Attribute 'TEST 'of the Component B in Component A. Normally it should come if node is exposed as interface BUT It is not coming.

Hope you understood requirement. For Trial purpose i exposed method : SET_ATTRIBUTE as interface in this way i don't think it will work.

BR

-CW

former_member262988
Active Contributor
0 Kudos

Hi,

In order to get the data from Child Component to Parent Component we need to declare the Node to be interface node,which you have done correctly.

Component -->B is used in Component --> A. So the Test Node is available in Component A if we use the Component B as used component in Component A.

So on each action of the button click in Component B call the method which will set the Node attribute value(SET_ATTRIBUTE)so that on each click the new value is set.

Now as the node is an Interface Node the values should be availabale in Component A.

--> Try to remove the node from Compoennt A and do the binding again.

Thanks,

Shailaja Ainala.

saravanan_narayanan
Active Contributor
0 Kudos

I want to access Attribute 'TEST 'of the Component B in Component A. Normally it should come if node is exposed as interface BUT It is not coming.

Carlin, you will get the TEST attributes value in Component 'A' only if the value for 'TEST' attribute is set in Component 'B'.

in Component A, if you try to read the value of TEST attribute before its value been set in Component 'B' then you will get empty value only.

in some way you need to tell the component 'B' to set the value for 'TEST' Attribute before accessing it in Component A.

one way is to expose the SET_ATTRIBUTE method and calling the same from Component A

another way is to embed the B's interface view into A's view and then explicitly clicking on the buttons in B's interface view.

Unless the value is not set by Component B, if you it access in Component A, you will get initial value only.

Hope its clear.

BR,

Saravanan

carlin_willams
Participant
0 Kudos

Hello Saravan,

I am setting the attribute value in Child Component "B" Before calling the Component A.

Still i m not getting the value it's strange.

BR

-CW

Former Member
0 Kudos

Hi,

Is the Input element structure property of the context node is checked or not..what it is set to?

Regards,

Lekha.