Skip to Content
0

Design Studio - Input Parameter/variable passing value from DATEFIELD component

Feb 21, 2017 at 10:33 PM

619

avatar image
Hi, I have got a HANA view having an input parameter on date column, input value should be taken based on a DATEFIELD component in Design Studio. I have got below function from SAP help document, APPLICATION.setVariableValue("IP1", DATEFIELD_1.getDate()); I am not able to conclude where should I place it, I mean which event of application?

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

q22ro.png (8.2 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Mustafa Bensan Feb 22, 2017 at 01:17 AM
1

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.

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

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?

0

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.

0
Sreekanth Surampally Mar 03, 2017 at 04:15 PM
0

Thanks Mustafa, it works. Your answers are very helpful and making point always.

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

Thanks Sreekanth. Happy to help.

0