5 Replies Latest reply: Nov 18, 2010 8:18 AM by Miguel Angel Baeyens de Arce

# 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

• ###### How to find Server Name?

From help:

#### ComputerName( )

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

-Alex

• ###### How to find Server Name?

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.

• ###### How to find Server Name?

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).

• ###### How to find Server Name?

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

• ###### How to find Server Name?

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