on 2021 Aug 11 7:37 PM
Hello SAC Experts!
I would like to know how to create a script to display a Text widget with all the comments based on the dimension filters of a table widget in an Analytic App.
For example, the Table displays Cost Centers + GL Accounts in the rows, and Version + Account Measure in columns.
For all the combinations of Cost Centers + GL Accounts displayed in the Table, I would like to have a widget to display the existing data point comments for that filters.
By now I could only display for 1 single dimension combination.
Kind regards
Mayumi
Request clarification before answering.
Hi may24071978_ ,
probably not best practice, but you could scrape the whole resultset of the table for comments:
1. i.e. get the resultset of the tables datasource and the DataSourceComments for this tables datasource as well.
2. loop over the resultset and for each entry build up a Selection
3. with this Selection you can query DataSourceComments (getAllComments).
4. Iterate over the CommentInfo to pick up the values you need into one string and add this result as e.g. 'CellComment ' to your current Selection from step 3.
for (var j = 0; j < myCellComments.length; j++ ){
myCurrentSelection['CellComment ' + j.toString()] =
'{commentId:' + myCellComments[j].commentId +
', createdAt:' + myCellComments[j].createdAt +
', createdBy:' + myCellComments[j].createdBy.id +
', numberOfLikes:' + myCellComments[j].numberOfLikes.toString() +
', text:' + myCellComments[j].text + '}';
...
With that you should have the dimension values and respective comments in one data structure with which you can fill a text field.
best regards,
Simon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
adrweb
Selections:
https://help.sap.com/doc/958d4c11261f42e992e8d01a4c0dde25/release/en-US/index.html#Selection
In short: iterate over the resultset and for each entry in it, retrieve the dimension id and its value id and add it to a selection.
-> { dim1 : idvalue of dim1, dim2 : idvalue of dim2, .....}
you can initialize a selection variable like this (adding Version by default to it, which will get its value assigned in the loop through the resultset)
var myCurrentSelection = cast(Type.Selection, {'Version':''});
Simon
User | Count |
---|---|
54 | |
6 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.