Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to obtain the document name in the script.
I am using version 8.20.5415.2 in my computer and version 8.20.5402.2 in the Server.
I have an application that uses the DocumentName() function to obtain the name of the document and it worked fine in my computer.
When I published the application on the server the script didn't recognize the DocumentName() function when loading the application. So I need to find another way to obtain the name.
I read everything I found on the blog.
- The system variable QVWorkPath is not good because it is loaded only at the end of the script. (First load can give a wrong document name)
- Writing a function that returns the document name by using Function GETNAME() GETNAME = ActiveDocument.Name End Function hangs when running from the script. I am not an expert in Macros, I pick these lines from the forum.
- If I use ActiveDocument.GetProperties.FileName I obtain no value.
The last 2 are giving the path name if is use msgbox(ActiveDocument.Name) or msgbox(ActiveDocument.GetProperties.FileName) when testing the macro.
Someone can share any idea on how to obtain this name?
Thank you
I'm not sure if you need this in a script or macro, but I'm almost sure you need this in a script.
if that's the case FileName() should do the trick.
Hi dragonauta. FileName() does not give me the document name. In the qv help I found for filename() the following definition that is not what I am looking for "Returns a string containing the name of the table file currently being read, without path but including the extension".
What I need is the document name and not a table or file that is used in the document. Thank you anyway.
Hi,
I had a similar issue.
The only possibility I found is to call a macro and the filename (if you need it all the time you could call the macro with the OnOpen trigger.
dim strFilePath
Dim strFileName
strFilePath = ActiveDocument.GetProperties.FileName
strFileName = (InStrRev(strFilePath,"\",len(strFilePath)))
strFileName = Mid(strFilePath, InStrRev(strFilePath,"\") + 1)
Please have a look at the attached example.
Best regards
Stefan
Is anybody out there having a better solution / a solution without using macros?
Best regards
Stefan
Thank you Stefan,
Are you able to obtain that value from your qlikview script. If yes, could you please send me some tips on how to call that macro from the script?
Hmm,
oh, I've overseen that you need it from loadscript.
Have a look at the attached example; this does not work; I think that's because the "Application" object in macro is not initialized while load-script.
Sorry for not having better news ...
Best regards
Steafn
sorry, forget to mention:
Have a look into the load-script of my updated example ...
Best regards
Stefan
Patricio,
have you tried DocumentName()? This is my example:
LET vDocName = DocumentName();
DocInfo:
LOAD 'Document Name' as Property
, '$(vDocName)' as Value
autogenerate(1);
This works on QV9, try this on QV8.2.
- Ralf
Thank you Ralph,
Yes I have tried it. This is the origin of my problem. DocumentName() worked on my computer but it didn't work when I published on the server. I am looking for something different so I can publish on the server with the same functionality. Please see first post for details.