Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
bchip01
Contributor II
Contributor II

Finding Bookmark selection value

Hi

Im trying to build an extension that shows all the bookmarks, the fields and their selection values.

I use getList(Bookmarklist...) to get the bookmark ids and the fields, which works.

I am just really struggling to get the selection values.

Ive tried

app.createGenericObject({
handle: 1,
method: 'GetSetAnalysis',
params: {
qStateName: '',
qBookmarkId: 'bb780b29fd-d4f4-4405-b790-e1742c94'
}
}, reply1 => {
console.log('6:'+console.log(JSON.stringify(reply1)))
});

Ive tried several other variations of this as well.

What is weird is that if I enter this into the Engine API explorer then it returns the correct value.

 

Any help would be highly appreciated

Labels (2)
1 Solution

Accepted Solutions
rankassovitz
Employee
Employee

now I see. you're using the extension (capability) api. the app object you're using does not have those engine calls.

please traverse your app object app.model.enigneApp before using "raw" engine calls. Here's the full example from your point of view:

define( [ "qlik"
],
function ( qlik) {
	var app = qlik.currApp();
	return {
		support : {
			snapshot: false,
			export: false,
			exportData : false
		},
		paint: async function ($element) {
			//add your rendering code here
			$element.html( "get bookmark set analysis value" );
			const book = await app.model.engineApp.getSetAnalysis(
				{
				"qBookmarkId": "7ac00977-18a7-4aba-b5af-661b23e25909",
				"qStateName": "$"
			});
			console.log("book", book)
		}
	};
} );

 

View solution in original post

4 Replies
rankassovitz
Employee
Employee

Hello @bchip01 ,

It's likely a syntax issue. Please try:

const book = await app.getSetAnalysis({
    "qBookmarkId": "7ac00977-18a7-4aba-b5af-661b23e25909",
    "qStateName": "$"
});

console.log(book)

bchip01
Contributor II
Contributor II
Author

Hi. Thanks for the response.

I tried the code but no results yet.  I added the code into an async function.

If I call it with the original code then nothing is returned, if I call it with a dummy text string it returns the text string correctly.

 

async function getBKValues ( ) {
var app = qlik.currApp(this);
/*
const book = await app.getSetAnalysis({
"qBookmarkId": "b135617b-b643-4ed4-be7c-7a43cf4gg45",
"qStateName": "$"
});
*/
var book ="test123";
console.log("5B: "+JSON.stringify(book));
return book;
}

//-----------------

getBKValues()
.then((data) => { console.log('1')})

 

Also the ID's the enter I get from:

app.getList("BookmarkList", function(reply){
reply.qBookmarkList.qItems.forEach(function(bookmark){

console.log('1='+bookmark.qInfo.qId);

}

rankassovitz
Employee
Employee

now I see. you're using the extension (capability) api. the app object you're using does not have those engine calls.

please traverse your app object app.model.enigneApp before using "raw" engine calls. Here's the full example from your point of view:

define( [ "qlik"
],
function ( qlik) {
	var app = qlik.currApp();
	return {
		support : {
			snapshot: false,
			export: false,
			exportData : false
		},
		paint: async function ($element) {
			//add your rendering code here
			$element.html( "get bookmark set analysis value" );
			const book = await app.model.engineApp.getSetAnalysis(
				{
				"qBookmarkId": "7ac00977-18a7-4aba-b5af-661b23e25909",
				"qStateName": "$"
			});
			console.log("book", book)
		}
	};
} );

 

bchip01
Contributor II
Contributor II
Author

Wow!

 

Thanks so much, learned a lot from this thread.