on 01-05-2015 6:20 PM
I have a Problem with my listBox OutPut Display in Design Studio 1.3:
Have Two Data source:
1) DS_1 for Dimension Filter
2) DS_2 for ListBox
Bex Query DS_1 has fields/columns like Country key and Country Name of Member Array Type
Another Bex Query DS_2 has fields/columns like Country key, Country Name(Member Array) , State Names(Member Array)
Now when i select single/multiple member items from an Country Dimension Filter, Iam trying to display the selected countries and each country with required Statenames in my listBox OutPut Display. For this i tried so far with the below lines of code in script of Dimension Filter which was not displaying as expected.
var Countries = DS_1.getFilterText("YCoun");
var aCountry = Countries.split(";");
aCountry.forEach(func(country, i){
LISTBOX_1.addItem("" + i, country);
var aState=DS_2.getMembers("YStat", 10);
aState.forEach(func(state) {
LISTBOX_1.addItem(state.internalKey, state.text);
DS_2.setFilterExt("YCoun", Countries);});});
Tried searching the entire forum if for any two datasources settings needed in dimension filter and refering the documentation didnt get any clue so far.
Any ideas? is this default behaviour in Dimension Filter or am i missing something wrong on the code mentioned above.
Thanks so much
- Dinya.
Hi,
You don't need different datasources for 2 dimensions .
In Your Data Source DS_1 ( Edit Initial View )
Right Click on State Column --> Members for Filtering --> With Posted Data .
Then Try the Code Below .
var Countries = DS_1.getFilterText("YCoun");
var aCountry= DS_1.getMembers("YCoun");
aCountry.forEach(func(country, i){
LISTBOX_1.addItem("" + i, country);
});
DS_2.setFilterExt("YCoun", Countries)
// Once this is filtered only members in state are those which belongs to respective countries
// (selected in Dimension Filter ).
var aState=DS_2.getMembers("YStat", 10);
aState.forEach(func(state) {
LISTBOX_1.addItem(state.internalKey, state.text);
;});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nikhil and All Experts,
Tried the above code and already set with posted data, the second line of your code retrieves all the countries in the listbox + filtered countries as well rather only filtered countries.
State displayed only for India but not US.
In ListBox(OutPut) it displays now after adding your code like below:
US
India
Mumbai
Delhi
Pune
Chennai
US is not showing its state.
Load Button:
I have copied the same code to show all countries and under it states by default like below:
var Countries = DS_1.getFilterText("YCoun");
var aCountry= DS_1.getMembers("YCoun");
aCountry.forEach(func(country, i){
LISTBOX_1.addItem("" + i, country);
});
DS_2.setFilterExt("YCoun", Countries)
// Once this is filtered only members in state are those which belongs to respective countries
// (selected in Dimension Filter ).
var aState=DS_2.getMembers("YStat", 10);
aState.forEach(func(state) {
LISTBOX_1.addItem(state.internalKey, state.text);
;});
The List Box messes and showing nothing at startup onload when dimension filter are not selected and when selected it is behaving like i mentioned above.
Thanks for your early response.
-Dinya.
Nikhil,
Tried now, the US also was showing the states like india in List Box like below Onload script
US
India
Load Button:
var aCountry= DS_1.getMembers("YCoun");
aCountry.forEach(func(country, i){
LISTBOX_1.addItem("" + i, country);
});
DS_2.setFilterExt("YCoun", aCountry)
// Once this is filtered only members in state are those which belongs to respective countries
// (selected in Dimension Filter ).
var aState=DS_2.getMembers("YStat", 10);
aState.forEach(func(state) {
LISTBOX_1.addItem(state.internalKey, state.text);
;});
Now when i select single/multiple member items from an Country Dimension Filter, Iam trying to display the selected countries and each country with required Statenames in my listBox OutPut Display
Apply Script:
I have copied the same code to show all countries and under it states by default like below:
var Countries = DS_1.getFilterText("YCoun");
var aCountry= DS_1.getMembers("YCoun");
aCountry.forEach(func(country, i){
LISTBOX_1.addItem("" + i, country);
});
DS_2.setFilterExt("YCoun", Countries)
// Once this is filtered only members in state are those which belongs to respective countries
// (selected in Dimension Filter ).
var aState=DS_2.getMembers("YStat", 10);
aState.forEach(func(state) {
LISTBOX_1.addItem(state.internalKey, state.text);
;})
Do I need to do anything specific on Apply Filter to bring up the data from the data source into ListBox on selecting specific/Multiple countries on apply the dimension filter Country?
Any ideas would be helpful on this tried searching forum and alerting but not getting the selected country and its state in the ListBox.
Thanks,
-Dinya.
Hi,
First of All you are using LISTBOX_1 for both Country and States .
You should have two different Components for each Dimension
( Like LISTBOX_Country & LISTBOX_States ) .
//On Start up :
LISTBOX_Country.setItems(DS_1.getMemberList("COUNTRY", MemberPresentation.TEXT, MemberDisplay.TEXT, 100));
LISTBOX_Country.onSelect();
//On Select Event of LISTBOX_Country :
var Country_Selected = LISTBOX_1.getSelectedValues();
DS_1.setFilter("COUNTRY", Country_Selected);
LISTBOX_State.setItems(DS_1.getMemberList("STATE", MemberPresentation.TEXT, MemberDisplay.TEXT, 100)) ;
Hi Nikhil and Other Experts,
This doesnot matches my requirement.
Have Two Data source:
1) DS_1 for Dimension Filter
2) DS_2 for ListBox
Bex Query DS_1 has fields/columns like Country key and Country Name of Member Array Type
Another Bex Query DS_2 has fields/columns like Country key, Country Name(Member Array) , State Names(Member Array)..
Now when i select single/multiple member items from an Country Dimension Filter, Iam trying to display the selected countries and each country with required Statenames in my listBox OutPut Display.
For this what i was trying so far as mentioned in my post.
Thanks,
Dinya
Hi,
In Initial View .
Right Click on State Dimension --> Member For Filtering --> Values with Posted Data .
//On Apply Event of COUNTRY DIMENSIONFILTER :
LISTBOX_STATE.removeItems(); // Remove All Items .
LISTBOX_STATE.setItems(DS_1.getMemberList("STATE", MemberPresentation.TEXT, MemberDisplay.TEXT, 100)) ;
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
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.