Skip to Content
avatar image
Former Member

Design Studio 1.6 - Display corresponding column values of a specific Row from the query results

I have a BEx Query that returns 4 columns (2 Characteristics - Start Month (ZSTARTMON) & End Month (ZENDMON) and 2 Key Figures) as shown in the below example. This query runs before the application is loaded and always returns 24 rows (2 years) of data.

Environment: DS 1.6 SP3 & BEx Query

Note: "Row No" is for illustration purpose

I need to get the data from the 11th row and the last row (23rd row) from the above query result set and display them in the text boxes like shown below.

Basically I need to be able to get each individual corresponding column value of the 2 rows - 11th & 23rd and set those values in the individual text boxes. From the above result set it would return the following

Current Year : {TEXTBOX_1: 08/2015 , TEXT_2: 07/2015 , TEXT_3: “KF 1 value”, TEXTBOX_4: “KF 2 value”}

Previous Year: {TEXT_5: 08/2014, TEXT_6: 07/2014, TEXT_7: “KF 1 value”, TEXT_8: “KF 2 value”}

I wrote the below code which works (copied a few lines here) but I realized that it’s not a good practice as I have to duplicate the code for each variable (probably need 8 variables in this case) and repeat it for both the rows. Such a huge overhead and realized what if there are more KF columns and need to get multiple rows data for eg:- 1st, 7th etc., not ideal.

var CuYrStartMo=DS_1.getMembers("ZSTARTMON ", 24);

var CuYrEndMo=DS_1.getMembers("ZENDMON", 24);

CuYrStartMo.forEach(function(StartMoCY_element, index) {

CuYrEndMo.forEach(function(EndMoCY_element, index) {

if(index==23){

TEXT_1.setText(StartMoCY_element.internalKey);

TEXT_2.setText(EndMoCY_element.internalKey);

}

});

});

I'd like to achieve this in more cleaner and dynamic way rather than writing multiple & repetitive lines of code. I looked in to the concept of sing arrays & Global scripting but so far I haven’t been able to come up with a solution. Does anyone know how to achieve this? Any help would be appreciated.

Here are some of the links I referred to and a re helpful but they return the row data after making the selection on Crosstab whereas in my case I just have to read the rows without any user selection

https://archive.sap.com/discussions/message/16117362#16117362

https://archive.sap.com/discussions/thread/3501219

Thanks,

Dilip

1.jpg (44.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 15, 2016 at 05:41 AM

    Hi Dilip,

    What you have described is to be able to iterate through a result set or lookup data from specific rows. As you have discovered there is not a very effective way of achieving this with standard functionality. I would recommend that you consider using the Design Studio 1.6 SDK Data Iterator component. It will allow you to reference specific rows and retrieve the key figure column values for those rows.

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded