Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

load script for each problem

Hello,

I am trying to modify a load script where we have for each and if-condition.

It goes through all the qvd files. And I don't want it to load qvd files that are not from the year 2015 or 2016 and forward.

So we have

for each file in filelist(folderpath & '\*')

if lower(right('$(v.found.file)',3))='qvd' then

etc

That works

But if I put

for each file in filelist(folderpath & '\*')

if lower(right('$(v.found.file)',3))='qvd'

AND num(lower(left('$(v.found.file)',4))) > num(2014) then

it does not work, it skips the whole thing!

What is wrong and how can I do double if?

Cheers,

Niko

15 Replies
Not applicable
Author

That did the trick! Wow.. What happens in that subfield()-set?

Thank you!

Cheers,

Niko

Kushal_Chawda

lets say you have value in vFile as D:\Data\QVD\2015-05.qvd

inner subfield('$(vFile)','\',-1) - picks up 2015-05.qvd and our subfield picks up the 2015 from (2015-05.qvd)

Anonymous
Not applicable
Author

Hi Niko,

It is more easy:

for each vFile in filelist(folderpath & '\*.qvd')

    if subfield(subfield('$(vFile)','\',-1),'-',1) >=2015 then

          ....

     end if

next


Kind regards.

Not applicable
Author

Nice! Have to remember this subfield() in the future, seems to be very useful.

Thanks a lot again

Always learning new things here about QlikView.

Cheers,

Niko

Kushal_Chawda

Yeah, Qlik community is gr8.

Not applicable
Author

Yes, it surely is!