Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
did
Employee
Employee

GetActiveSheetId using Navigation API

hi community,

today I came across the following issue: how to get active sheet id in Qlik Sense. 
As you know - the old famous function GetActiveSheetId() is not available in QS. The only way is to:
A. copy paste it manually from the URL
B. use extension to write it down into a variable.
As I did not find any extension able to do this I asked people around - @Riley McDonald was the one who helped me out to implement it - MANY THANKS Riley!

If you are interested in  using it:
- import the extension
- open your QS app and create a variable vSheetId
- drag and drop the extension on every sheet where you want to use active sheet id
- use the following syntax in the extension bject or in any other object on the sheet: ='$(vSheetId)'
- keep in mind: this extension is invisible in analysis mode, but visible in edit mode.

Enjoy 🙂

3 Replies
did
Employee
Employee
Author

zip file

MichaelCB
Contributor
Contributor

Hi Denis!@did

THX for the prompt support concerning my request !  Also shout outs/ big thx goes to @Riley McDonald !  How about expanding the java shell with a 2nd var APPID() to make it complete ? 

To read the user-id we can use the still existing function osuser(), right ?

Hope there are no plans on side QLIK to kick the last os-system-var out of QLIK Sense , too 🙂  still wondering why that kind of senseful system-vars has been kicked out since qlik-view

Otherwise a third auto-var like "userid" would make sense within your extension (just to be on the safe side).

At the moment i use UPPER(SubField(osuser(), 'Id=',2)) to read my userId.

  • Further last idea would be a lookup function, which takes a look within a certain table and column for the exisiting entry of a combined key like appid()&sheetid()&userid()
  • corresponding parameters for the func should be : (tablename,columname_key)
  • return codes/RC for the func could be 
    • -1 (meaning:  called table does not exist)
    • -2 (meaning: called columname_key does not exist
    • 1 (meaning: allowed/auth. entry found within the table)
    • 2 (meaning: found nothin' /would mean key doesnt exist/no auth!
  • in case of  returning RC=2  when calling the func , the creation /bringing up a popup-Window messaging "no authorization" would be awesome!

Lesson Learnt for me : it would at last be time to learn how to program java 🙂 so at that point Riley is a god 🙂

Question to @Riley McDonald just to calm down our admin when i must ask him to import the new extension ...my company is "Fort Knox" concerning extensions as Dennis already could experience 🙂 

New Java-Script/extension should have the same logic  used within qlik view ?

Unless the used api-names  won't change with an release update , that extension should run/be stable until the rest of days , which would be my asumption and understanding of the script?

 

did
Employee
Employee
Author

Hi Michael,

This extension is very simple, but I doubt that it will function "until the rest of days" because we don't know  how APIs and Java Script will be like in the future. This extension is a quick & dirty answer to the needs and questions raised at your side recently.

You posed lot of good questions regarding this GetActiveSheetID-Extension. As I am not able to answer them I would recommend to use a proper extension  Riley posted recently in git - https://github.com/rileymd88/qwik-variable/releases/download/v0.0.1/qwik-variable.zip . With Riley's extension you have 2 main guarantees which you don't have with the extension posted here: 1. git is proper platform for extensions; 2 Riley is a proper developer able to make changes.