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: 
paulyeo11
Master
Master

How to make my directory on button dynamic change ?

Hi All

I have 10 QVW app. i make use of 1 page main menu to place 10 button to call any QV doc. i place all QV doc at server it work fine now.

But my issue is if i am off line , it will not work . because my note book is not link to server.

So i need to manually change all the button to another directory .alternative i create another new Tab , which is link all button directory to local drive.

may i know how can i make use of var to change the directory ? so that i only need to change one location.

Hope some one can give me some hint to kick start.

Paul

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Paul,

PFA, you can simply use variable to achieve that.

View solution in original post

6 Replies
paulyeo11
Master
Master
Author

enclosed my sample doc

Not applicable

Hi,

Through Macro's we can achieve this. Please find the attachment.

paulyeo11
Master
Master
Author

Hi Sir

thank you vey  much for your sharing.

I just open your qvw file , and i guess your macro below have 2 directory name , so i believe for one time i can only have 1 directory right ? so in case now i use vLocation11 , i only need to insert the 2nd line. and when i change the directory to vLocation12 , i need to remove the 2nd line code , right ? it is also mean by doing this i can use find and replace the directory name very fast ? 

set oFS = CreateObject("Scripting.FileSystemObject")

vLocation11 = "Q:\QPRICE\GE FANUC\q_price_ge.qvw"

vLocation12 = "P:\QPRICE\GE FANUC\q_price_ge.qvw"

tresesco
MVP
MVP

Paul,

PFA, you can simply use variable to achieve that.

Not applicable

Hi,

Here my Idea was, I will keep the directries in 2 different variables(I assume vLocation11 as default location) and another variable vLocation can be set the active location(either vLocation11 or vLocaiton12) by macro.

Here I have used 2 button objects; The first button object (which is appearing on the sheet) is to execute the Macro and the second button object (whcih is in hidden mode) will be pressed automatically by the end of macro. This can be opened the application.

About Macro code:

To check any file/locaiton is exists in a specificed location, we need to create object of "Scripting.FileSystemObject" first. By using this, we can use the function FileExists() to check the specified file/location is avilable or not.

Finally, when the user press the button to open the document, Macro will be called and set the appropirate locaiton into the variable vLocation and then macro will press the second button dynamically. The second button will open the application wich is from the vLocation.

I hope, you are clear from my wording now.

 

paulyeo11
Master
Master
Author

Hi Sir

Thank you for your very detail explanation.