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

Need to write #include or variable statement

Hi All,

My question related to 1 qvd placed in two different locations.I am having clustered servers : server A and Server B

abc.qvd = placed in "C:\Folder A" and same Qvd placed in C:\Folder B.

server A   : sales.qvw access the  sale2010.qvd from "C:\Folder A"  and  qvd accessing from server A.

Server B   : sales.qvw access the  sale2010.qvd from "C:\Folder B"  and  qvd accessing from server B.

if server A goes down  then  server B is active  and  the sales.qvw will take the qvd from "C:\Folder B" instead of "C:\Folder A".

Folder A belong to Server A and Folder B belong to Server B.

I need to write #include or variable statement to where I can pass the string  to  sales.qvw and that can pick up the  qvd  from folder B instead of folder A.

Thanks & Regards,

Gunjesh J

7 Replies
swuehl
MVP
MVP

Maybe like using this in your script:

Let vPath = If(ComputerName( ) = 'Server A', //check if computer running the script is 'Server A'

                              'C:\Folder A',                    // path for server A

                             If(ComputerName( ) = 'Server B', //check if computer running the script is 'Server B'

                                             'C:\Folder B',              // path for server B

                                              ''                              // Set path when no server matches to empty?

                              )

                    )

Of course you need to adapt the server names to what is returned by OS when calling ComputerName()

ComputerName( )

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

Alternatively, you can use an include statement in your QVW

$(Must_Include=Paths.qvs);

And use two distinct files on each server with a different LET statement to define the path

Let vPath = 'Server A';

resp.

Let vPath = 'Server B';

Hence having the same QVW on both server, but different qvs.

With all approaches, use the vPath variable in your qvd load statements:

LOAD *

FROM [$(vPath)\sale2010.qvd] (qvd);

Or maybe consider just using 1 QVD on 1 location?

Regads,

Stefan

Not applicable
Author

Hi Stefan,

Thanks for replying.

I just wanted to know  "Paths.qvs" containing which  code?

What I understood.

There are two ways I can achieve after seeing your code.

either  This,

Let vPath = If(ComputerName( ) = 'Server A', //check if computer running the script is 'Server A'

                              'C:\Folder A',                    // path for server A

                             If(ComputerName( ) = 'Server B', //check if computer running the script is 'Server B'

                                             'C:\Folder B',              // path for server B

                                              ''                              // Set path when no server matches to empty?

                              )

                    )

This the path of qvd's :   'C:\Folder A',  where qvd store  for server A right ?// path for server A?

This the path of qvd's :   'C:\Folder B',  where qvd store  for server B right ?// path for server A?

OR

second statement :

$(Must_Include=Paths.qvs);

And use two distinct files on each server with a different LET statement to define the path

Let vPath = 'Server A';

resp.

Let vPath = 'Server B';

Hence having the same QVW on both server, but different qvs.

swuehl
MVP
MVP

You would have two distinct Paths.qvs, one for each server. Both qvs files are named the same, but containing different Let statements.

And yes, I described two different approaches, one using ComputerName(), one using include files.

Does this clarify your concern?

Not applicable
Author

Hi Stefan,

Thanks!!!

in path.Qvs what path we have to mention? if we are $(Must_Include=Paths.qvs);?

Paths.QVS =  vPath = 'Server A'; and vPath = 'Server B';? or  path for QVD's stored in different location?

i.e.

the path of qvd's :   'C:\Folder A',  where qvd store  for server A right ?// path for server A?

This the path of qvd's :   'C:\Folder B',  where qvd store  for server B right ?// path for server A?

swuehl
MVP
MVP

Sorry, I don't understand the question.

You have two servers, ServerA and ServerB, right?

You have the same QVW on both servers, right?

Then you need to add the include statement to the QVWs, and put a Paths.qvs file in the same folder where the QVW reside.

The name of this file is the same, Paths.qvs, so it can be included from both QVW without any change.

The content is different, defining the paths to your QVD specifically for each server, using LET as shown above.

Not applicable
Author

hi,

My question is what we have to put  in Path.qvs ?

Thanks

swuehl
MVP
MVP

A single line

Let vPath = 'C:\Folder A';



for server A, Replace the path on the other server accordingly.