cancel
Showing results for 
Search instead for 
Did you mean: 

Attributes

Former Member
0 Kudos

Hi,

Can any global variable or a memory variable which can be defined for a view... so that i can store a value in it and retrieve it when i come back to this view.

points will be rewarded for helpful anwers

regards,

raksha

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Raksha,

You can do that by declaring an <b>Attribute</b> in the view by going to the <i><b>Attribute</b></i> tab in the view.

You can then access this simply using <b>wd_this->MY_ATTR</b>

Also, take care that this will store data only during a view's lifetime. In such cases, you can have the attribute in your component controller also.

To access the attribute of component controller from view controller, simply use

<b>wd_comp_controller->MY_ATTR</b>

Former Member
0 Kudos

Hi Neha,

I have used the same.... i.e. defined an attribute and set its value... but when i come back... it has lost the value... i have no clue why this happens?

you have any idea?

Former Member
0 Kudos

Hi Raksha,

If you are navigating out of the view, then define your attribute in the attributes tab of the component controller. You can access this attribute using wd_comp_controller->attribute_name. The value will be retained when you come back.

Regards

Nithya

Former Member
0 Kudos

Hi Raksha,

There can be two reasons. One is that either your view's lifetime ends. In such a case, define the attribute in your component controller and use wd_comp_controller as I mentioned before. Another reason can be that you are creating your component in another component and then deleting it somwhere. In such a case, define your attribute in the context of the parent component (rather than somewhere in the attributes tab) and share the value using context sharing.

Hope this is what you were looking for.

Regards,

Neha

Former Member
0 Kudos

Define it as an attribute in your view. Go to the attributes tab and define your variable. It can later be accessed as wd_this->attribute_name.

You can also define attributes in the comp controller, if it is needed across views. Then use wd_comp_controller->attribute_name to access it.

Export to and import from memory IDs can be used as well, but having it as attributes in your comp controller or view would be better.

Regards

Nithya

Former Member
0 Kudos

Hi,

I have used the same.... i.e. defined an attribute and set its value... but when i come back... it has lost the value... i have no clue why this happens?

you have any idea?