on 03-30-2017 9:19 AM
Hi,
I would like to read the "country" attribute value of a company member selected in a dropdown. I tried the following script without success :
var cc = DROPDOWN_CC.getSelectedValue(); //company code selected DS_1.getMembers("COMP_CODE", 99).forEach(function(element, index) { element.getAttributeMember("COUNTRY");
if (element==cc) {
APPLICATION.alert(element.text);}
});
thanks for your help
Mat
Hi Agata
thanks for your help. It worked for me. The internalkey was the solution I guess. My dropdown has a target bound to DS_1 which means that DS_1 has always one value. May be that is the reason why it worked for me
thanks again
Mat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Mat, good to know the attribute works if you filter your data source to just one member.
A.
Mat,
I have tried this, and unfortunately, it doesn't seem like DS is reading the attributes correctly - it retrieves ("All_members") instead.
Also, I don't think element === cc is doing the right thing. cc will be returned as a value, element has its internalKey, externalKey, as well as text etc. These two have to match. So, it seems they only match if you do element.internalKey == cc.
The below code displays the matching element, selected country, and its attribute:
var cc = DROPDOWN_1.getSelectedValue();
var myArray = DS_1.getMembers("0CUSTOMER", 99);
var country = "";
myArray.forEach(function(element, index) {
if(element.internalKey == cc) {
country = element.getAttributeMember("OCOUNTRY").internalKey;
APPLICATION.alert(element.internalKey + " " + cc + " " + country);
}
});
You will notice that the code works, selecting the right member in the if statement, but the attribute is incorrect:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.