Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
We have implemented saving a bookmark in our C# .NET application:
using var app = location.App(appIdentifier, session);
var metadef = new NxMetaDef();
metadef.Set("title", title);
metadef.Set("description", description);
var createBMResult = app.CreateGenericBookmark(
new GenericBookmarkProperties
{
Info = new NxInfo
{
Id = string.Empty,
Type = "bookmark"
},
MetaDef = metadef
});
var bookmark = app.GetGenericBookmark(createBMResult.Info.Id);
bookmark.Publish();
We would like to also save the layout with the bookmark. How do we achieve this?
(When creating a bookmark in Qlik you can check the alternative "Save layout". How is this done programmatically?)
I found a solution that works:
using var app = location.App(appIdentifier, session);
var metadef = new NxMetaDef();
metadef.Set("title", title);
metadef.Set("description", description);
// Get the sheet object and its layout and object ids of objects in layout
var sheetObject = (Sheet)app.GetObject<GenericObject (sheetId);
var sheetLayout = sheetObject.Layout;
var idsOfObjectsInSheetLayout = sheetLayout.Cells.Select(x => x.Name);
var createBMResult = app.CreateBookmarkEx(
new GenericBookmarkProperties
{
Info = new NxInfo
{
Id = string.Empty,
Type = "bookmark"
},
MetaDef = metadef
},
idsOfObjectsInSheetLayout);
I found a solution that works:
using var app = location.App(appIdentifier, session);
var metadef = new NxMetaDef();
metadef.Set("title", title);
metadef.Set("description", description);
// Get the sheet object and its layout and object ids of objects in layout
var sheetObject = (Sheet)app.GetObject<GenericObject (sheetId);
var sheetLayout = sheetObject.Layout;
var idsOfObjectsInSheetLayout = sheetLayout.Cells.Select(x => x.Name);
var createBMResult = app.CreateBookmarkEx(
new GenericBookmarkProperties
{
Info = new NxInfo
{
Id = string.Empty,
Type = "bookmark"
},
MetaDef = metadef
},
idsOfObjectsInSheetLayout);
Hello @ludmillab
Glad to see that you could find a solution.
That is correct.
CreateGenericBookmark (.NET SDK) / CreateBookmark (Engine API) do not save the layout.
CreateBookmarkEx (.NET SDK) / CreateBookmarkEx (Engine API) will save the layout.