Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
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

1 Solution

Accepted Solutions
Kushal_Chawda

try this

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

if lower(right('$(vFile)',3))='qvd' and subfield(subfield('$(vFile)','\',-1),'-',1) >=2015 then

...

end if

View solution in original post

15 Replies
tamilarasu
Champion
Champion

Try,

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

Not applicable
Author

Hi Niko,

There is syntax error. Opening brackets count and close brackets counts are not matched.

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

try this.

-Joyson G

Not applicable
Author

Nope, it did not work either.. Still skipping the script phase.

Kushal_Chawda

'$(v.found.file)' instead '$v.found.file)'

Not applicable
Author

Yeah, there was a typo.. But it isn't still working

Kushal_Chawda

what is Filename?

Not applicable
Author

They are all like

2013-06.QVD

2013-07.QVD

.

.

.

and so on

Kushal_Chawda

try this

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

if lower(right('$(vFile)',3))='qvd' and subfield(subfield('$(vFile)','\',-1),'-',1) >=2015 then

...

end if

tamilarasu
Champion
Champion

I am not sure why this is not working for you. I did a test and it's working.