on 01-03-2015 8:24 PM
I wanted to create a control that would extract all of the dimensions from a data source, and then create a single string with comma separated values.
I started with the simple table sample and kept the following component:
<property | |||
id="column1" | |||
title="Column X" | |||
type="ResultCellList" | |||
group="DataBinding"> | |||
<option name="includeFormattedData" value="true"/> | |||
<option name="includeMetadata" value="true"/> | |||
</property> |
I then modified the afterUpdate function to:
this.afterUpdate = function() {
if(JSON.stringify(this.metadata()).length){
try{
for(i=1; i < this.metadata().dimensions[1].members.length-1; i++){
if(i==1){
commaStr = this.metadata().dimensions[1].members[i].text;
}
else{
tempStr=commaStr;
commaStr = tempStr + ', ' + this.metadata().dimensions[1].members[i].text;
}
}
alert(commaStr);
}catch(e)
{
}
}
};
This does give me the output that I want:
string_1, string_2, string_3, string_4, ...
My questions are:
Thanks,
Robert
Hi Robert,
probably you already had a look into the developer guide but I would like to point you in particular to the pages 28 and 43 ff on the matter of using ResultSet or ResultCellList.
http://help.sap.com/businessobject/product_guides/AAD14/en/ds14_dev_guide_en.pdf
When using ResultSet you can set the associated variable to "{}", which means all of the data will be send to your control. That way you don't need to set any columns. For convenience put a default value in your contribution.xml file.
Changing your property's type from ResultSet to ResultCellList should be enough.
Now on to your last question, I would suggest using your favorite browser's developer tools which you could access via F12 and to put a breakpoint near afterUpdate. In addition to that you could output your metadata json with console.log(JSON.stringify(<your var name>)) to learn its structure and content. I wouldn't recommend the alert function as the json can get quite lengthy.
Hope this helps.
Regards
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.