Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If then based on data source

  • I have multiple Excel files which are being loaded from two different folders; we'll call them folder x and folder y
  • The data in folder x is newer than that of folder y
  • I want to write an If statement to say something to the effect of:

If (data came from folder x, (do this...),(Else do this...)

Is this possible? If so, what syntax would you suggest?

Thank you,

John

4 Replies
sunny_talwar

Maybe something like this:

SET vFolderXFile = 'FolderX\FileName.xlsx';

LET vFolderXExist = If(FileSize(vFolderXFile) > 0, -1, 0);

SET vFolderYFile = 'FolderY\FileName.xlsx';

LET vFolderYExist = If(FileSize(vFolderYFile) > 0, -1, 0);

IF $(vFolderXExist) then

     ...

ENDIF;

IF $(vFolderYExist) then

     ...

ENDIF;

HTH

Best,

Sunny

oknotsen
Master III
Master III

What kind of things are you trying to achieve?

During the load process, you know from which folder you are loading, so do you really need the if-statement? You can just implement those expressions / functions while loading from the specific source.

So, please try to explain what exactly you are trying to do or achieve so we can give you a more specific answer .

May you live in interesting times!
Not applicable
Author

A system my company uses was recently upgraded and changed the date format in a particular field.

The date used to be: Fri Aug 01 01:58:00 GMT 2014

Now it is: 3/28/2015 3:42:11 PM

We already have scripting to break down the old date into just the Date and Time fields from the historical files, but I need to create a script to separate the date and time for the date field from the new files.

My thinking was: (part of this is now being based off of Sunny’s suggestion, whom I still need to thank for the suggestion.)

SET vFolderXFile = 'FolderX\FileName.xlsx';

LET vFolderXExist = If(FileSize(vFolderXFile) > 0, -1, 0);

If($(vFolderXExist),

(Date(Floor(Timestamp#(CreatedTime-Time#(4,'MM/DD/YYYY'))))),

(Date(Floor(Timestamp#(replace((Right(Trim(CreatedTime),24)),'GMT ',''),'MMM DD hh:mm:ss YYYY')-0.208333333),'MM/DD/YYYY')))

as ,

oknotsen
Master III
Master III

If the old system is phased out, than maybe you do not need to keep loading the old files.

Load them once, store them as QVD, and in the future only load that QVD.

In your load script, load the new source files (while in the process adjusting your date to how Qlik stores it), followed by loading your QVDs which will now automatically concatenate.

But maybe I am completely misunderstanding your problem.

May you live in interesting times!