Skip to Content

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

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 22, 2017 at 01:17 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Mar 03, 2017 at 04:15 PM

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

    Add comment
    10|10000 characters needed characters exceeded