Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Task in QMC should automatically start running as soon as someone places a particular excel file in a local folder.
How can this be achieved ?
One possible reason are the wrong fieldnames mentioned already from Anil. Another is the missing second/third parameter from the peek-function which are necessary if the function is used outside from a load-statement. The default-behaviour for this case isn't documented anywhere - I think it takes the value from the last loaded table but I'm not really sure - this meant it's always better to set them explicitly, like:
let v_OldDate=peek('Filetime_Old', -1, 'Table1')
Beside this I would rather not use num() in this case and if I wouldn't use single-quotes around the variables by comparing them - just: $(v_OldDate) because the content is numeric - whereby I didn't think that this is related to your problem.
To see which values are really within the variables use some trace-statements like:
trace $(v_OldDate);
and/or run the script within the debugger and/or take a look within the script-log.
Independing of the above mentioned things I would compare the filetimes directly like:
if FileTime(Incremental.xls) <> FileTime(Old_Data.qvd) then
// this
else
// that
end if
- Marcus
You could create a qmc-task which checked per filetime() - directly or within a filelist-loop - if the file exists respectively has changed and which might be triggered to 1 minute. The (un)successful run of this task could trigger your origin task.
If something like this isn't suitable you will probably need an external batch/routine to monitor the folder and to trigger an external qmc-task maybe per Using EDX in QlikView 11 - basic example.
- Marcus
Marcus,
i was working on the first solution as provided in your comment.
But i am facing some issue while comparing both the date variables.
Below is my script :-
Table1:
Load num(Filetime_Old) as Filetime_Old
from Old_Data.qvd;
let v_OldDate=peek('Filetime-Old')
Table2:
Load num(FileTime() ) as Filetime_New
from Incremental.xls;
let v_NewDate=peek('Filetime-New')
if '$(v_NewDate)' <> '$(v_OldDate)' Then
Drop Table Table1;
ELSE
Drop Table NONExistingTable;
ENDIF
In current Scenario, v_NewDate and v_OldDate are having exactly same values but still if case is being loaded rather than choosing else case.
What could be the issue here ?
Format is same for both fields.
Seems you made mistake here
let v_OldDate=peek('Filetime-Old')
let v_NewDate=peek('Filetime-New')
Field Name must be placed as wrong. Try Filetime_Old instead of Filetime-Old
It's actually Filetime_Old and Filetime_New .
By Mistake, wrote it like other way.
One possible reason are the wrong fieldnames mentioned already from Anil. Another is the missing second/third parameter from the peek-function which are necessary if the function is used outside from a load-statement. The default-behaviour for this case isn't documented anywhere - I think it takes the value from the last loaded table but I'm not really sure - this meant it's always better to set them explicitly, like:
let v_OldDate=peek('Filetime_Old', -1, 'Table1')
Beside this I would rather not use num() in this case and if I wouldn't use single-quotes around the variables by comparing them - just: $(v_OldDate) because the content is numeric - whereby I didn't think that this is related to your problem.
To see which values are really within the variables use some trace-statements like:
trace $(v_OldDate);
and/or run the script within the debugger and/or take a look within the script-log.
Independing of the above mentioned things I would compare the filetimes directly like:
if FileTime(Incremental.xls) <> FileTime(Old_Data.qvd) then
// this
else
// that
end if
- Marcus
I started with the solution as mentioned in last part of your reply but was not sure if
FileTime(Old_Data.qvd) will provide time of QVD Creation or source xls file.
Let me try this and confirm you back.
If i am not using single-quotes around the variables in if statement ,then below error is coming,
neither it reads right side value nor it provides a proper result.-
Yes the right part returned NULL - I think that the path and/or the filename aren't quite correct - it should look like:
filetime('FullPath\FileName.FileExtension')
- Marcus
Thanks for providing your inputs.
Right side was coming null only in variable but not if loaded directly.
I just wrote max() while loading it and it worked somehow.