When the document reloads, you can work that around with something like
LET vServerName = ComputerName(); // Since the reloads takes place in the server, the variable will return the server name
You can even save this value in a QVD file in case you move the document or reload it in different computers
ServerName:LOAD '$(vServerName)' AS QvServerNameAUTOGENERATE 1; STORE ServerName INTO ServerName.QVD; DROP TABLE ServerName;
Now you can use this variable to create the UNC path:
LET vDocumentPath = '\\' & ComputerName() & '\abc\text.qvw';
and use it later on the script to load the documents
LOAD * FROM '$(vDocumentPath)'\File.qvd (qvd);
Hope this helps.
I thought of avoiding ComputerName() as the folder path breaks if you open the document in client system.
But looks like there is no alternate. I am just hardcoding folderpath to point test server if the document is opened in client system. That way my main issue resolved (i could migrate documents whichout any code change from test to production server).
Thanks all for your inputs.
It works fine if we open the document by giving full address (like \\xyz\abc\test.qvw)
But if we open from mapped directory QvWorkPath value is E:\\abc\test.qvw)
Does the server have accessible E:\abc\test.qvw ? Maybe obvious but, when using UNC paths, you don't necessarily refer to actual paths, but to shared drives, so you will have to check that either. I've been testing and loading from network drives works well. Check that the correspondence (in the server) between the UNC path and the network drive is working fine.
In your example above, assuming that "xyz" is your server name and "abc" the name of the shared folder, the right path could be E:\test.qvw (if E: is mapped to \\xyz\abc)
Hope that helps