cancel
Showing results for 
Search instead for 
Did you mean: 

How to apply simple filter to Data Source

Former Member
0 Kudos

I have a simple dataset with 3 dimensions and no measures. I'm looking to simply filter by team and pull the Engineer and Advocate dimensions into string variables. When working with measures this is a piece of cake, just struggling here.

I need this function, but for dimensions:

var gblTeam = "TEAM01";

var pob = DS_DATASET.getData("MeasureColumn", {
"Fleet Manager": gblTeam
}).value;

Thanks in Advance!

Dataset:

Accepted Solutions (0)

Answers (3)

Answers (3)

MustafaBensan
Active Contributor
0 Kudos

Hi Chris,

Assuming that each Team has only one Engineer and Advocate assigned, you can apply the concept of cascading filters to obtain the Engineer and Advocate corresponding to the selected Team as follows:

1) In the Data Source Initial View Editor for data source DS_DATASET, set the Members for Filtering option of the Engineer and Advocate dimensions to "Only Values with Posted Data"

2) Apply the following script code in the "On Select" event of the Team Dropdown:

DS_DATASET.setFilter(<Team Dimension>, me.getSelectedValue());
var EngineerName = DS_DATASET.getMembers(<Engineer Dimension>, 1)[0].text;
var AdvocateName = DS_DATASET.getMembers(<Advocate Dimension>, 1)[0].text;

Regards,

Mustafa.

howsy
Explorer
0 Kudos

Dear Chris,

I am sorry, but I guess I need to disappoint you. As far as I can see, you want to Filter for one Dimension (Team) and get the resulting Element out of that selection. This is not possible with Design Studio, as you can not read the Data Source iterative. You will always get all posted values out of a dimension, when typing "getMembers....".

So even when you filter by TEAM1, you will get all names available in the System.

However, there is a workarround. If you have the possibility to install SDKs to your System, you can have a look to the "DataIterator", provided in the SCN Community: https://blogs.sap.com/2016/02/08/design-studio-16-sdk-data-iterator-read-your-data-row-by-row-finall...

Another hint: With Lumira 2.x Designer, it is finally possible to do a iteration through your Datasource.

https://blogs.sap.com/2017/12/19/dynamic-apps-in-lumira-2.1-iterating-over-a-resultset/

Here I have a little dummy-Demo in Lumira for you:

Result on the right, when not filtered:

Result on the right, when filtered:

The coding for this function:

I hope that helps?
Regards,
Chris

patrick_brophy2
Discoverer
0 Kudos

Hello Chris,

I see that there is one Engineer and Advocate to each Fleet Manager.

So, are you trying to select a Fleet Manager and then concatenate the Engineer and Advocate into a string based on the selection?

What components are you using to achieve this?

The reason I ask is if you are using simple components such as the Dropdown Box or Listbox Components, property binding can do this for you (see the below screen shot):

In your case, you could have a global string variable retrieve the value or text from the second and third Dropdown Box Components.

Anyway, I hope this helps.

Best Regards,

Patrick