Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
pgriffiths
Creator
Creator

QvWorkPath and DocumentPath not updating.

Hi all,

I have been trying to figure this one out but can't seem to find out why these variable are not correct.

I assign the values of the variables (QvWorkPath and DocumentPath) and use them within my script, but they do not relate to the current location of the document but the development location.

From what I can see they should reflect the documents current location.

Has anyone got any idea how I can find out the current location of the QVW file that is being executed.

Many thanks.

1 Solution

Accepted Solutions
pgriffiths
Creator
Creator
Author

It may not be clear from the other posts, but relative paths resolved the problem for me.

Here is the code I use.

LET vPathFilename_Qvw = '.\' & DocumentName(); //Create a relative path to the filename of this QVW dashboard.

I then modify the path to give me a AuditLog filename in the same path as the QVW file by doing the following.

LET vPathFilename_AuditLog = replace(vPathFilename_Qvw, '.qvw', '_AuditLog.QVD'); //Filename of the AuditLog should be the same as vPathFilename_Qvw but with _AuditLog before .qvw

I then use the variable vPathFilename_AuditLog for the location of the file.

This works great for me.

Hope it helps.

View solution in original post

14 Replies
tresesco
MVP
MVP

Filepath()

Load

          *,

          filepath( ) as X

from C:\UserFiles\abc.txt;


Will return 'C:\UserFiles\abc.txt' in field X in each record read.

pgriffiths
Creator
Creator
Author

Hi treseco,

thanks for your time.

filepath() gives the path to the data file being loaded within a load statement.

The help file says:

Returns a string containing the full path to the table file currently being read.

I am after the path to the QVW document being executed.

From what I have read  (QvWorkPath and DocumentPath) should be the variables used for this, but they don't work correctly all the time as they seem to keep the development path.

quwok
Creator III
Creator III

These are system defined variables and cannot be changed. If you like to work with different paths, you'll have to define your own variables.

pgriffiths
Creator
Creator
Author

The Help file says the following.

DocumentPath( )

Returns a string containing the full path to the current QlikView document.

However when I test this by developing a document on our network drive it outputs the network path correctly.

When this is copied and runs from our server, it still shows the development network path instead of the execution C drive path of the QVW file being executed.

This is unexpected and is not the path to the file that I need when the script is executed.

I get the same with vWorkPath. The felp file says the following

Returns the browse string to the current QlikView document. A system-defined variable

quwok
Creator III
Creator III

Having re-read your post a little bit more, have you reloaded the document in the "current" location? These variables are set when the document is refreshed and may still hold the values of the previous environment.

tresesco
MVP
MVP

QvWorkPath should work. I don't understand your statement.

Peterjohn Griffiths wrote:

......but they don't work correctly all the time as they seem to keep the development path.

Have you tried using QvWorkPath?

pgriffiths
Creator
Creator
Author

Hi Kwok Chong,

I may not of been clear about this, sorry, but yes I am running the document on the Qlikview server and this updates the QVW but the paths used are the development paths, not the location of the QVW.

I am setting the variables manually as a workaround but then this script is no longer dynamic and makes for a maintenance nightmare.

It seems to me that these variables do not do what they should, update when the script is first executed.

pgriffiths
Creator
Creator
Author

Yes and it keeps the development path when the script is executed.

tresesco
MVP
MVP

If you run reload at one place and place the qvw into another path, this could be a problem using the system path variables. You could possibly use Relative Path and perhaps an organised folder structure. Refer this nice post by Steve Dark : http://www.quickintelligence.co.uk/qlikview-folder-structures/