cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

TammyPowlas
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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)"}

Accepted Solutions (0)

Answers (1)

Answers (1)

MustafaBensan
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

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)"}
MustafaBensan
Active Contributor
0 Kudos

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.