Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a Qlikview app that compares totals from two different file sources when both files are present. My problem is this:
I would like to view the totals when FILE_A is created but FILE_B does not yet exist. If FILE_B does not exist then I want to use zero (0) for the FILE_B totals. If FILE_B does exist, then I want to use the actual FILE_B totals to compare the files.
Is there any way to write a "conditional" load statement that will load FILE_B only if it exists otherwise load 0 to each FILE_B column name? Something like this:
IF FILE_B EXISTS THEN
LOAD
FIELD1,
FIELD2,
FIELD3
FROM FILE_B
ELSE
LOAD * INLINE [ FIELD1,FIELD2,FIELD3
0,0,0
];
Does anyone have any thoughts on this?
Thanks,
Ed T.
Hey Ed,
Try this
set vFile = 'C:\filepath\file.qvd';
let vExists = if(FileSize($(vFile))>0,1,0);
if $(vExists) THEN
LOAD
FIELD1,
FIELD2,
FIELD3
FROM FILE_B
ELSE
LOAD * INLINE [ FIELD1,FIELD2,FIELD3
0,0,0
];
End If;
I took the example from previous threads regarding this topic. You may find them helpful as well.
Hey Ed,
Try this
set vFile = 'C:\filepath\file.qvd';
let vExists = if(FileSize($(vFile))>0,1,0);
if $(vExists) THEN
LOAD
FIELD1,
FIELD2,
FIELD3
FROM FILE_B
ELSE
LOAD * INLINE [ FIELD1,FIELD2,FIELD3
0,0,0
];
End If;
I took the example from previous threads regarding this topic. You may find them helpful as well.