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: 
Not applicable

How to find Server Name?

Hi,

I am working to automate QV app migration from test to prod server.

I am using QvWorkRoot (or QvWorkPath) to find the document folder address.

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)

Is there any system/environment variable which gives server name?

I see ComputerName(). But when i open the document (from testserver) in my desktop it gives my computername and the folder path will break.

Thanks,

Boopathi

5 Replies
Not applicable
Author

From help:

ComputerName( )

Returns a string containing the name of the computer as returned by the operating system.

-Alex



Miguel_Angel_Baeyens

Hello Boopathi,

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.

Not applicable
Author

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.

Not applicable
Author

Suppose you are in server qv_srv_001. Nothing stops you from sharing folders on drive E. That will make e:\what\ever\ be same thing as \\qv_srv_001\what\ever

-Alex

Miguel_Angel_Baeyens

Hello Boopathi,

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