Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm able to get the bookmarks list and the right setanalysis values, using this simple code:
var layout = app.GetAppLayout();
var bkms = app.GetBookmarkList();
foreach (var bkm in bkms.Items)
{
var bkmData = bkm.Data;
TextHelper.WriteLine(1,$"{bkmData.Title} > {bkmData.SelectionFields}");
var sa = app.GetSetAnalysis("$", bkm.Info.Id);
TextHelper.WriteLine(2, $"Bookmark filters: {sa}");
}
In the specific case, I have a field named "Anno" (year) set to 2019.
I would like to change it to 2020 by code. Is this possible? I cannot find any methos like "app.SetSetAnalysis" or something to update the setanalysis of that specific bookmark.
Can you post an example?
Thank you
hello,
So you want to change Bookmark or want to change Field?
hello,
i found one solution just check it out,
if you have kpi then please try this steps
1. in engine api select one app after selecting app you have one method called getObject and pass this JSON
{
"handle": 1,
"method": "GetObject",
"params": {
"qId": "JjUqzF" // You have to pass object id of kpi
},
"outKey": -1,
"id": 4
}
2. Use SetProperties method and pass this JSON and change your expression
{
"handle": 2,
"method": "SetProperties",
"params": {
"qProp": {
"qInfo": {
"qId": "JjUqzF",
"qType": "kpi"
},
"qExtendsId": "",
"qMetaDef": {},
"qStateName": "",
"qHyperCubeDef": {
"qStateName": "",
"qDimensions": [],
"qMeasures": [
{
"qLibraryId": "",
"qDef": {
"qLabel": "",
"qDescription": "",
"qTags": [],
"qGrouping": "N",
"qDef": "count(EmployeeCount)", // change your date here
"qNumFormat": {
"qType": "U",
"qnDec": 10,
"qUseThou": 0,
"qFmt": "",
"qDec": "",
"qThou": ""
},
"qRelative": false,
"qBrutalSum": false,
"qAggrFunc": "",
"qAccumulate": 0,
"qReverseSort": false,
"qActiveExpression": 0,
"qExpressions": [],
"qLabelExpression": "",
"autoSort": true,
"cId": "ZFJMEf", // change this CID as object Id
"numFormatFromTemplate": true,
"measureAxis": {
"min": 0,
"max": 100
},
"conditionalColoring": {
"useConditionalColoring": false,
"singleColor": 3,
"paletteSingleColor": {
"index": 6
},
"segments": {
"limits": [],
"paletteColors": [
{
"index": 6
}
]
}
}
},
"qSortBy": {
"qSortByState": 0,
"qSortByFrequency": 0,
"qSortByNumeric": -1,
"qSortByAscii": 0,
"qSortByLoadOrder": 1,
"qSortByExpression": 0,
"qExpression": {
"qv": ""
},
"qSortByGreyness": 0
},
"qAttributeExpressions": [],
"qAttributeDimensions": [],
"qCalcCond": {
"qv": ""
},
"qCalcCondition": {
"qCond": {
"qv": ""
},
"qMsg": {
"qv": ""
}
}
}
],
"qInterColumnSortOrder": [
0
],
"qSuppressZero": false,
"qSuppressMissing": true,
"qInitialDataFetch": [
{
"qLeft": 0,
"qTop": 0,
"qWidth": 500,
"qHeight": 10
}
],
"qReductionMode": "N",
"qMode": "S",
"qPseudoDimPos": -1,
"qNoOfLeftDims": -1,
"qAlwaysFullyExpanded": false,
"qMaxStackedCells": 5000,
"qPopulateMissing": false,
"qShowTotalsAbove": false,
"qIndentMode": false,
"qCalcCond": {
"qv": ""
},
"qSortbyYValue": 0,
"qTitle": {
"qv": ""
},
"qCalcCondition": {
"qCond": {
"qv": ""
},
"qMsg": {
"qv": ""
}
},
"qColumnOrder": [],
"qLayoutExclude": {
"qHyperCubeDef": {
"qStateName": "",
"qDimensions": [],
"qMeasures": [],
"qInterColumnSortOrder": [],
"qSuppressZero": false,
"qSuppressMissing": false,
"qInitialDataFetch": [],
"qReductionMode": "N",
"qMode": "S",
"qPseudoDimPos": -1,
"qNoOfLeftDims": -1,
"qAlwaysFullyExpanded": false,
"qMaxStackedCells": 5000,
"qPopulateMissing": false,
"qShowTotalsAbove": false,
"qIndentMode": false,
"qCalcCond": {
"qv": ""
},
"qSortbyYValue": 0,
"qTitle": {
"qv": ""
},
"qCalcCondition": {
"qCond": {
"qv": ""
},
"qMsg": {
"qv": ""
}
},
"qColumnOrder": []
}
}
},
"showTitles": false,
"title": "",
"subtitle": "",
"footnote": "",
"showDetails": false,
"showMeasureTitle": true,
"textAlign": "center",
"fontSize": "M",
"useLink": false,
"sheetLink": "",
"openUrlInNewTab": true,
"visualization": "kpi"
}
}
}
4. if you want this JSON for other like barchart or anything just use GetProperties method so you can get this json.. use this json in set properties with your change expression..
if you need More help just reply
Thanks Regard,
Harsh Gohil
I want to change the year's value of a bookmark from 2019 to 2020.
I can't find any method to change the bookmark's filter values. I can only get the values using the GetSetAnalysis(bookmarkId) method.
Do you think it is possible to update a bookmark via the .net sdk? I thought it would be quite simple but it's not 😞
Thank you
hello,
I'm not sure but i think its not possible .. you have to create new bookmark .
Thanks Regards,
Harsh Gohil
This is not possible I'm afraid. There are no API endpoints that allow you to modify an existing bookmark. The only thing you can do is to create a new one based on the selection state of the engine.
However, I think you should be able to automate the flow by doing something like this:
It's an awkward flow, and you'll get a new ID for the bookmark, but perhaps that can help you along.
Hi @Øystein_Kolsrud ,
In above reply you mentioned one point like "Apply the new, modified expression as a selection". Is it possible to modify the Set Expression in bookmark? If it is possible please share that method.
Thanks
@Manoj_PrabuNo, the situation is the same as before. You can not modify the selection encapsulated by an existing bookmark. You can only create new ones. But you can get the set analysis expression describing a bookmark using this method:
Corresponding method in the SDK:
Hi @Øystein_Kolsrud ,
Thanks for the reply. I also saw that GetSetAnalysis method to get the selection. what i actually need is to set my own set expression for selection while creating bookmark...is it possible.
is it possible to do multiple selection of field and values instead of using GetField and SelectValues for each value for bookmark creation?
These are my questions...
Thanks
I've replied to the other thread you refer to. You should probably have a look at the selection methods that exists for list objects and hypercubes in the GenericObject class.