Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I find the current directory?

I created an app in e.g. TestFolder, and then copied it to e.g. LiveFolder.  Now, I want to know which folder my app is running in to create different security in Section Access.  If I trace the QvWorkPath variable at that point it still shows TestFolder.  (I read in the help file that system variables are set at creation time?)  Is this usual, and how should I be finding the current directory?

Cheers,

Colin

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Just reload the qlikview file, now you will get the latest path by using the QvWorkPath.

If reload is not possible try File -> Partial Reload option.

Hope this helps you.

Regards,

Jagan.

View solution in original post

6 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

Just reload the qlikview file, now you will get the latest path by using the QvWorkPath.

If reload is not possible try File -> Partial Reload option.

Hope this helps you.

Regards,

Jagan.

swuehl
MVP
MVP

Or use the QV system function

DocumentPath( )

to get the current doucment path, should work even without reloading.

Hope this helps,

Stefan

Not applicable
Author

Yes, found a forum post about changing Qlikview to update the variables at the start of the script rather than the end.

Thanks, guys.

Not applicable
Author

DocumentPath() returns the file path but not the current directory. I could not find an easier way to get the current path (without reloading) so I did the following:

/*Stores Current Working Directory into VarName*/

SUB CurrentWorkingDirectory(VarName)

  Let N = SubStringCount(DocumentPath(),'\');

  Let $(VarName) = SubField(DocumentPath(),'\',1);

  for i = 2 to N

       Let $(VarName) = '$($(VarName))\'& SubField(DocumentPath(),'\',$(i));

  next

ENDSUB

swuehl
MVP
MVP

=Left(DocumentPath(), Index(DocumentPath(),'\',-1))

?

Not applicable
Author

doh! yes that is much better