Skip to Content
author's profile photo
Former Member

Attributes

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 07:06 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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?

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 07:48 AM

    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>

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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