Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Read QWV path into a variable

Hi all,

I want to get the QWV file path into a variable in order to use it for the laod-files.

Here was an idea:

QWV path in VBScript

to retrive only path :

tmpPath = ActiveDocument.GetPathName

lastBackSlash = InStrRev( tmpPath , "\" )

path = Left( tmpPath , (lastBackSlash - 1) )

The problem is, that there is an mistake in the script.

Can anyone help.

Thank you very much!

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Robert

Jagan's suggestion should work, as in :

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

Best Regards,     Bill

View solution in original post

9 Replies
jagan
Luminary Alumni
Luminary Alumni

Hi,

The below script is working fine for me and returns the path of the current Qlikview file, what mistake you are getting.  Where you are using it?

Sub Test

tmpPath = ActiveDocument.GetPathName

msgbox(tmpPath)

lastBackSlash = InStrRev( tmpPath , "\" )

path = Left( tmpPath , (lastBackSlash - 1) )

msgbox(path)

End Sub

Regards,

Jagan.

Anonymous
Not applicable
Author

Thank you fpr your answer.

I didn't put it into a sub.

Is there a possiblity to get the information in the script without using a sub?

Thank you very much!

Anonymous
Not applicable
Author

Robert

The function DocumentPath( ) should be what you need.

It returns a string containing the full path to the current QlikView document.

Best Regards,     Bill

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

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

Regards,

Jagan.

Anonymous
Not applicable
Author

Hi Bill,

thank you for your answer.

But now I have the problem that, the result is:

d:\test1\qlikview\DocumentPath( )\

How can I delete this part (DocumentPath( ))

Thank u fpr your help

Anonymous
Not applicable
Author

Robert

Jagan's suggestion should work, as in :

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

Best Regards,     Bill

Anonymous
Not applicable
Author

Hi Jagan,

thank you four your answer, but

SET Speicherort = Left(DocumentPath(), Index(DocumentPath(), '\', -1) - 1);

leads to

D:\TEST\QLIKVIEW\Left(DocumentPath(), Index(DocumentPath(), '\', -1) - 1)

Anonymous
Not applicable
Author

Robert

Use LET instead of SET.

Best Regards,     Bill

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Robert,

You need to be using Let instead of Set.

That should then work.