Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Want to load data based on below condition:
Suppose I have two computers 'A' and 'B' then my load condition should be,
if(ComputerName() = 'A')
Load
A.Data as DataA
From xyz path;
if(ComputerName() = 'B')
Load
B.Data as DataB
From xyz path;
Please help me to write this code in QlikView script editor??
May be like this:
IF ComputerName() = 'A' then
FirstLoadHere
ELSEIF ComputerName() = 'B' then
SecondLoadHere
ENDIF;
May be like this:
IF ComputerName() = 'A' then
FirstLoadHere
ELSEIF ComputerName() = 'B' then
SecondLoadHere
ENDIF;
Try this:
if ComputerName() = 'A' then
Load A.Data as DataA From xyz path;
else
Load B.Data as DataB From xyz path;
end if
- Marcus
Hi Sunny and Marcus,
Can you please let me what is wrong in this code? why it is showing red line? Please see attached image.
if ComputerName() = 'ATHENA-BLD-02-P' then
Load
[(PDH-CSV 4.0) (Central Daylight Time)(300)] as Time_Interval
FROM
[$(vDataFile)CPU_RAM_Usage.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
elseif ComputerName() = 'B' then
Load
[(PDH-CSV 4.0) (Eastern Daylight Time)(300)] as Time_Interval
FROM
[$(vDataFile)CPU_RAM_Usage.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq)
endif;
There is a semi-colon missing after the file-format statement.
- Marcus
Yes you are missing a semi-color at the end
IF ComputerName() = 'ATHENA-BLD-02-P' then
TableName:
Load
[(PDH-CSV 4.0) (Central Daylight Time)(300)] as Time_Interval
FROM
[$(vDataFile)CPU_RAM_Usage.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
ELSEIF ComputerName() = 'B' then
TableName:
Load
[(PDH-CSV 4.0) (Eastern Daylight Time)(300)] as Time_Interval
FROM
[$(vDataFile)CPU_RAM_Usage.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
ENDIF;
Instead of doing this in script why don't you just do conditional on front end.
Lets say you add two dimension
1) [(PDH-CSV 4.0) (Central Daylight Time)(300)]
Check enable conditional - if(Computername()='A',1,0)
2) [(PDH-CSV 4.0) (Eastern Daylight Time)(300)]
Check enable conditional - if(Computername()='B',1,0)
I don't think you can solve that with the computerName() function, it will never return more than computer name per execution, unless you change your .qvw from one computer to another in the middle of the execution.
Do you have one application per computer?
Kind regards,