cancel
Showing results for 
Search instead for 
Did you mean: 

Using Static Variable against Context Attribute for Holding IWDView

Former Member
0 Kudos

Dear Friends,

I have a method which is in another DC which has a parameter of the type IWDView. In my view, I will have an action which will call the method in another component by passing the value for the view parameter. Here, I can achieve this in 2 types. One is - I declare a static variable and assign the wdDoModifyView's view as parameter value and I can pass this variable as parameter whenever calling that method or the second way - create an attribute and assign the same wdDoModifyView's view parameter as its value. Whenever I call this method, I can pass this attribute as parameter. What is the difference between these two types of holding the value since I am storing the same value i.e., wdDoModifyView's view parameter. But when I trigger the action from different user sessions, the first type of code (using static variable) prints the same value in both the sessions for view.hashCode() and View.toString(), but the same is printing the different values when I pass the attribute which holds the view parameter.

Clarification on this is highly appreciated

The problem I face is when I use static variable to get the view instance and export the data using the UI element's id, the data belonging to different user sessions is mixed up where as when I use Context Attribute, the same problem doesn't arise. I want to know the reason why it is so. Is there any other place or way where I can get the current view instance of each session instead of wdDoModifyView?

Accepted Solutions (1)

Accepted Solutions (1)

govardan_raj
Contributor
0 Kudos

Hi Sujai ,

As you have specified the problem that we face when we use  static attributes, when end users are using the application .

Static means i  have n number of objects but the static variable value will remain same every where.

when it is context attribute for every object i.e nth object you have a nth context attribute i mean nth copy of the context attribute.

so every user has a unique Iview parameter , when context is used and

when static is used  , assume you have userA , his iview is set this intially  and u have another user B , when he is using  , since the variable is static and when you access this variable you will get the value of userA.

Regards

Govardan Raj

Former Member
0 Kudos

Thanks Govardan

Answers (0)