cancel
Showing results for 
Search instead for 
Did you mean: 

Compare values in list box

Former Member
0 Kudos

Hi,

I need to compare initial and current value in the list box. I' am trying to do the comparison in onSelect event.

Here how can I get the initial value. I guess we will get the current value here. Or let me know if you have

some better suggestions.

Thanks,

Aravind

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Can I assume that Initial value as the first value or the last selected value.

Regards,

Lekha.

Former Member
0 Kudos

There is no initial value here. You are changing values in the list box. You need to compare old value and new value.

Thanks,

Aravind

Former Member
0 Kudos

Hi,

You can implement the context change log for that context attribute to which the listbox is bound to.

There you can track the old and new values.

Or

When ever the user selects a value in list box, you need to store it to a temp variable for old value and you need to check it against the current selection.

Have you checked wdevent parameters...

These can be the 2 ways.

Regards,

Lekha.

Former Member
0 Kudos

Right now I' am trying to implement method two, storing the value in another attribute in the WDOINIT method.

Then in the onSelect method I' am comparing both the current and earlier values to show appropriate

messages.

Let me know how implement this context change log.

Thanks,

Aravind

Former Member
0 Kudos

In your approach of temp variable, you will have to keep refreshing your variable with the new value in the OnSelect Method. For eg: l_temp is initially set in WDDOINIT, now you compare this with the new selected value in the OnSelect method and after displaying the appropriate message you will again have to reset l_temp with the newly selected value. " note: I hope l_temp is declared in the attributes tab of the View If you wish to implement Context Change log, follow these steps; 1. Place the following code in the WDDOINIT method of the Component Controller

* enable context change log
    data: context type ref to if_wd_context.
    context = wd_context->get_context( ).
    context->enable_context_change_log( ).
2. Create a new method 'GET_CHANGE_LOG' in the Component Controller's Methods Tab
" Create a Returning Parameter 'CHANGES'  type WDR_CONTEXT_CHANGE_LIST 
method get_change_log .
    data: context type ref to if_wd_context.
    context = wd_context->get_context( ).
    changes = context->get_context_change_log( ).
endmethod.
3. When you want to track the changes call his this method as follows,
DATA: l_ref_componentcontroller TYPE REF TO ig_componentcontroller .
    DATA: l_changes TYPE wdr_context_change_list.
          
    l_ref_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
    l_changes = l_ref_componentcontroller->get_change_log( ).
 
"  l_changes will contain all the details of the changes made.
For more details refer component DEMO_CONTEXT_CHANGES. Regards, Radhika.

Answers (0)