Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Kunkulis
Creator
Creator

Load column if exists

Hello,

I am Loading several, same named qvds - User2019-10.qvd, User2018-10...User2013-10 etc. 

Now the issue is that on the first few qvds they are lacking one column - DateOfQvd.

I was thinking maybe there is a possibility to write some ifs to see if the files date is bigger then lets say 2010-06, if it is true, than load the data that contains the DateOfQvd if not than load the data without it.

If (Righ(User2010-06,7)>2010-06 then

Load * + DatOfQvd
From User2*.qvd (qvd) else

Load* (no DateOfQvd)
From User2*.qvd (qvd) end if

Or maybe it is possible to have a check of the column count somehow? 

 

Thank you in advanced

Labels (4)
13 Replies
asinha1991
Creator III
Creator III

I see try this and I rest my case 😄 I am sure it will work now

if date#(subfield('$(ftime)',' ',1),'YYYY-MM-DD')>date#('2013-04','yyyy-mm') then

 

 

Kunkulis
Creator
Creator
Author

It finally does work, but it doesn't go to the else Load where it doesn't load the QvdDate column:

2019-10-10 16:25:34 0011 if date#(subfield('2013-02-01 08:05:13',' ',1),'YYYY-MM-DD')>date#('2013-05','yyyy-mm') then
2019-10-10 16:25:34 0013 User:
2019-10-10 16:25:34 0014 LOAD Date(Date,'DD/MM/YYYY')&O_SHORT_DESC as [Version Manager],
2019-10-10 16:25:34 0015 [First Name],
2019-10-10 16:25:34 0016  [Middle Name],
2019-10-10 16:25:34 0017 [Surname],
2019-10-10 16:25:34 0018 [Email],
2019-10-10 16:25:34 0019
2019-10-10 16:25:34 0020 date(Date,'DD/MM/YYYY')&USR_HOME_ENTITY_ID as VersionID,
2019-10-10 16:25:34 0021 [User Name]
2019-10-10 16:25:34 0022 FROM [C:\Users\ME\Desktop\USER\USER2013-01.qvd] (qvd)
2019-10-10 16:25:34 Error: Field 'Date' not found
2019-10-10 16:25:36 Execution Failed
2019-10-10 16:25:36 Execution finished.

Kunkulis
Creator
Creator
Author

Got it to work, changed the date# to the general date format.

if date#(subfield('$(ftime)',' ',1),'YYYY-MM-DD')>date('41365','yyyy-mm-dd') then

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Why not just use "Load *" for everything?  Won't that pick up the date field if it exists?

-Rob