Skip to Content
0

setFilter or clearFilter is not returning the latest data from a data bound textbox

Feb 10, 2017 at 04:49 PM

87

avatar image

Hi,

I have bound a text box and am trying to dynamically read its value from the script which is triggered by a button by adding and removing filters using setFilter or clearFilter.

Although, I have observed that i do not have access to the actual refreshed data. Only when the control is transferred back to the page containing the component which triggered the event.

Please let me know if there is a way to access the refreshed data in the script itself?

1. Initial value (without any filters)


2. Value read from the Button (before filter)

3. Value read from Button (after filter). As seen, the correct data is not accessible.

4. Finally correct value is observed only when the alerts are closed and the control returns back to the initial screen

10 |10000 characters needed characters left characters exceeded

Would you please share your code on the script? This will help others help you

0

Hi Tammy,

I was using a basic filter on the button and hence didn't share the code. Below is the code.

/* Button script */
APPLICATION.alert("Sales before setting filter = "+TEXT_1.getText());
DS_1.setFilter("COUNTRY", "United Arab Emirates");
APPLICATION.alert("Sales after setting filter = " + TEXT_1.getText());

/* Chart data selection (Initial) */

{"(MEASURES_DIMENSION)":"SALES","COUNTRY":"(RESULT_MEMBER)"}
0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mustafa Bensan Feb 10, 2017 at 10:15 PM
0

Hi Saleh,

This is probably a timing issue since your script for reading the text component is being triggered within the "On Click" event of the button at the same time as filtering. You should be able to resolve your issue as follows:

1. In the "On Click" event of the button execute only the setFilter() script;

2. In the "On Result Set Changed" event of the data source bound to the text component execute the TEXT.getValue() script.

Regards,

Mustafa.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Mustafa,

Thanks for the response. I have altered the "On Result Set Changed" event but the issue still exists. My OnClick event also has the setFilter() script.

/* DS_1 OnResultSetChanged code*/
TEXT_1.getText();

/* Button script */
APPLICATION.alert("Sales before setting filter = "+TEXT_1.getText());
DS_1.setFilter("COUNTRY", "United Arab Emirates");
APPLICATION.alert("Sales after setting filter = " + TEXT_1.getText());

/* Chart data selection (Initial) */

{"(MEASURES_DIMENSION)":"SALES","COUNTRY":"(RESULT_MEMBER)"}
0

Hi Saleh,

You need to move the following code from the Button Script to the On Result Changed code to see the correct result:

APPLICATION.alert("Sales after setting filter = " + TEXT_1.getText());

Regards,

Mustafa.

0