on 02-21-2017 10:33 PM
I have tried using in Variable initialization event, but how would I get the value for DATEFIELD_1 component when an IP is called initially? I do not want to load entire data into Datasource from HANA but apply filter on reading itself. Please let me know, the appropriate way to do this..
Thanks
Sreekanth
Hi Sreekanth,
Ideally, for a cleaner solution, I think you should code your HANA view such that the date input parameter defaults to the current date because I think that on startup it makes sense to show the data related to the current date, instead of forcing the user to pick a date. They can then change the date afterwards if needed.
However, if you really want to implement the scenario exactly as you have described, then you should follow these steps:
1. Set the Load in Script property of the data source to true;
2. Apply the following code in the "On Select" event script of the Date Field component:
if (!DS_1.isInitialized()) {
DS_1.loadDataSource();
}
DS_1.setVariableValue("IP1", me.getDate());
Regards,
Mustafa.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Mustafa, Can you tell me when does this script gets executed? I think, it is On Select event, so when a value is selected in DATEFIELD component.
However, my data source is loaded with all the data from HANA view even before On Select event taken place, correct? for example user wanted to see only records greater than 2017.01.01 by selecting it DATEFIELD component, but this filter does not pushed to HANA view, brings all the data first, then DS_1 is filtered accordingly.
I am trying to understand, how the filter is pushed down to HANA view from Design Studio?
Sreekanth,
Please see my comments below:
1. "Can you tell me when does this script gets executed?"
As stated in Step 2 of my answer, the script is executed in the "On Select" event of the date field.
2. "However, my data source is loaded with all the data from HANA view even before On Select event taken place, correct?"
No this is not correct. In Step 1 of my suggested solution, the Load in Script property of your HANA data source should be set to true. Therefore it will not load automatically at startup. This is why the data source is loaded via script for the first time in the "On Select" event of the date field, as per the code I have provided.
3. "I am trying to understand, how the filter is pushed down to HANA view from Design Studio?"
The best way to understand this is by implementing the solution I have suggested, observing the behaviour and then asking further questions if needed for clarification.
Regards,
Mustafa.
Thanks Mustafa, it works. Your answers are very helpful and making point always.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.