on 04-12-2017 1:21 PM
Hello everyone,
I'm trying to get a filtered data source from a universe data source. I have a dropdown containing month items and when choose one of those month, the crosstab updates and show me only the data linked to the month.
Now what I want to get is only the data from this filtered data. However, When i use the getMembers() function, it gives all the data from my source and not only from the filtered crosstab data source.
So if you guys, have any idea, please help.
Regards
Etienne PASCAL
Thank you for replying.
As you can see in the code below, I'm filtering a universe data source by the OBJ_1 which is corresponding to label month. What I want do get are the members from this filtered data.
SOURCE_1.setFilters("OBJ_1",DROPDOWN.getselectedValue());
var myDates = SOURCE_1.getMembers("OBJ_1", 1000000000);
var len = myDates.length;
var lastDate = myDates[len-1];
TEXT_1.setText(lastDate.text);
However, when I look at what's behind the data after filtering it, I get all the data source and not only the filtered one. My intension is to get the last date data from the month I've selected in the dropdown.
So if you have any idea, I'll be pleased to get some.
Regards,
Etienne
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
DATA_SOURCE_FOR_CROSSTAB.setFilter("OBJ_5",DROPDOWN_MONTH.getSelectedValue());
var data = CROSSTAB_2.getDataSource();
var myDates = data.getMembers("OBJ_1", 1000000000);
var len = myDates.length;
var lastDate = myDates[len-1];
APPLICATION.alert(lastDate.text);<br>
Hi Mustafa
I'm filtering the universe data by month (OBJ_5), so when I check the crosstab, it updates as I want it and shows me only the dates correponding the the month I selected. That month is by default April. Thus it alerts me the last date of April.
However, when I change the month from my dropdown box, the crosstab updates as I excecpted but, the app alerts me the same date, April last date. That's why I think that when I filter the data source and want to get that one, it returns the global data and not the filtered.
So is there a way to get only the filtered data? Like a method named getFilteredDataSource(). It could be so usefull.
Regards,
Etienne
Okay, thanks Etienne. That's clearer now. Some points to consider:
1) Have you set the Members for Filtering option of the dimensions OBJ_5 and OBJ_1 to "Posted Values Only" in the initial view of the data source? This setting is what triggers cascading filters. However, issues have been reported with the cascading filter functionality for Universe data sources. By the way, what version of Design Studio are you running?
2) Even if you get the cascading filter to work, there is no guarantee that getMembers() will return the dates in ascending order as the sort order on members is not tied to the sort order of the data result set. Anyway, first things first. If you can confirm about the Members for Filtering setting we can proceed accordingly.
Thank you Mustafa for replying,
I'm using SAP BO DS 1.6, I believe that's the last version, and when I edit the initial view of my data source, there is no option as you can see on the screeshot below untitled.png, maybe because I'm using a Universe data source and not a Bex.
Hi Mustafa,
Sorry for being late at responding to your comment, I've been busy.
So I've upgrated my Design Studio to 1.6 SP4 and now I've the members for filtering option on setting data source initial view. However I still can't get the filtered data from my crosstab, so when I try to get the last data from the crosstab, it returns last date in the global data source.
Is there something I've forgotten?
Regards,
Etienne
Hello Mustafa,
These the screenshots you asked me.
The following code is the code that I use when the user select a month using the dropdown.
DS_1.setFilter("OBJ_5", DROPDOWN_1.getSelectedValue());
var data = CROSSTAB_1.getDataSource().getMembers("OBJ_1", 31);
var string = "";
data.forEach(function(element, index) {
string = string + element.text+ ",\n";
});
var res = string.split(",");
var len = res.length;
APPLICATION.alert("Resultat :"+res[len-2]+"\n String \n"+string+"\n");
TEXT_1.setText(string);
//APPLICATION.log(res[len-2]);
As you can see when I select a month like Jan or Feb, it returns the same string. Indeed, when I run the app on the BI Platform, the filter on month runs well on the crosstab view but when I try to get filtered data on the var string it returns me the global data as I said above.
So if you now a way to get directly for instance the line of the crosstab, I'll be pleased to know or any solution.
Thanks,
Etienne
Hi Etienne,
Thanks for the details. Your issue is clear now. To make it easier to determine the cause, let's try to simplify your application first. Can you make a copy of it and then apply the following changes?
1. Delete component DROPDOWN_1;
2. Add a Dimension Filter component, DIMENSION_FILTER_1;
3. In the Data Binding properties of DIMENSION_FILTER_1 assign DS_1 as the Data Source and "OBJ_5" as the Dimension;
4. In the "On Apply" event script of DIMENSION_FILTER_1, specify the following code:
var filteredDates = DS_1.getMembers("OBJ_1", 100);
var lastDate = filteredDates.pop();
TEXT_1.setText(lastDate.text);<br>
5. Execute the application;
6. From the Dimension Filter select a month and apply;
7. Confirm if the text field value corresponds to the last date shown in the Crosstab.
Regards,
Mustafa.
Hi Etienne,
On further thought, we can retain the structure of your original application and apply only the following changes:
1. Bind Data Source DS_1 to the Items of component DROPDOWN_1;
2. In the Source Properties of the Items binding of DROPDOWN_1, set Data Source to DS_1 and Dimension to "OBJ_5". Also set the Target Data Source to DS_1 and the target Dimension to "OBJ_5";
3. In the "On Select" event script of DROPDOWN_1, specify the following code only:
var filteredDates = DS_1.getMembers("OBJ_1", 100);
var lastDate = filteredDates.pop();
TEXT_1.setText(lastDate.text);
4. Execute the application;
5. Select a month from DROPDOWN_1;
6. Confirm if TEXT_1 displays the last date shown in CROSSTAB_1.
Regards,
Mustafa.
Thank you Mustafa,
I'll do what you've proposed me, but I would to ask you before doing it, if you know if it could cause some problems if my Design Studio Tool is upgraded to the last version (1.6 SP4) and the Design Runtime still the last version. If so, how can I upgrade also the Design Runtime and also get the version of it?
I'll keep you in touch when I finish trying your suggestions.
Regards
Etienne
Hi Etienne,
It seems to me that there is an issue with cascading filters for Universe data sources in your case. I tested both of the examples with a BW BEx Query data source and they worked as expected.
At this point I can only suggest 2 options:
1) Open an SAP Support Ticket
2) Use the Design Studio 1.6 SDK Data Iterator Component to get the last row in the filtered data source. This will definitely correspond to the Crosstab.
Regards,
Mustafa.
Hi Mustafa,
I've finally the solution to get access to the filtered data. The problem was the fact my the version of my Design Studio Runtime on BI Platform was older than the application that I've upgraded. So now I can get it.
However, there is a new issue that I can't explain. when i get the dates from the crosstab data, they're not keeping the sorting properties that I specified in the initial view. So do you know where the problem comes from?
Regards,
Etienne
Hi Etienne,
Good to hear your filtering issue is resolved. Your new issue is a known limitation of the getMembers() function whereby the sort order is based on the master data order and not the data source order. You could try changing the sort order in the Universe definition itself.
Regards,
Mustafa.
Hi Mustafa,
I really want to thank for all you've done to try to help. Now i got what I wanted so far. I did what you told me, directly
changing the sort order in the Universe definition itself, and it works so well.
Regards
Etienne
Hi Koen,
I've seen this video before but it doesn't give what I want to get. My main question is to know there is a way to get filtered data source? because when I use the getDataSource() method , it returns all the data from my source and not only the data that I filtered.
DATA_SOURCE_FOR_CROSSTAB.setFilter("OBJ_5",DROPDOWN_MONTH.getSelectedValue());
var data = CROSSTAB_2.getDataSource();
var myDates = data.getMembers("OBJ_1", 1000000000);
var len = myDates.length;
var lastDate = myDates[len-1];
APPLICATION.alert(lastDate.text);
Here the variable data always returns all CROSSTAB data and not the filtered one. For exemple my last month in dropdown box is April, so when I run the app it return the last date of April. However, when I change the month, for instance January , the crosstab shows the data linked to January but the last date still the same and the app doesn't get the last date of January ; it returns April's last date and it's the same for all the months in my dropdown box
Etienne
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
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.