Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
Here is my problem: I have a QVW which contains a macro that will fetch data from an internet file. After that macro runs, I need it to reload the document and save it. I do not want to use an OnOpen trigger or anything like that to kick off the macro, I just want to schedule a job to do it. Is there any preReload() function or anything similar? I am pretty experienced with the QV Desktop application, but I am new to the Server.
Thanks in advance for the help.
I guess I could create a dummy QVW file with a blank script. And that file would reload nothing then run the macro with an OnPostReload trigger. Then have my application run after that one is done.
Is there a smarter, more efficient way to go about doing this?
That is certainly an option. So it sounds like the data is being fetched and stored locally? Can it not be fetched dynamically in the load script ? Dont forget that if you reference a subroutine/function within the load script that isnt 'native' Qlikview it will look for a document macro and execute it if it finds it.
Regards,
Gordon
Sorry for the poor explanation. The data isn't actually being fetched by the macro, or else I would load it in the script like you suggested. What the macro does is: it queries a website, and this website has a server that dynamically produces a txt file. The macro returns the LOCATION of the txt file as a VARIABLE, which is then used in my load statement to load the data. So that txt file is actually only being created when my macro runs, and then telling me where the file is.
So I need the macro to run in order to get the location of the data before the script runs.
Any ideas?
Hi
Try this.
Add a variable to your script like vMacroRun. Set it to 1.
Set your macro to run on OnPostreload
In your script :
if vMacroRun = 1 then
// Do nothing
Set vMacroRun = 0; //
exit script;
else
// Your regular script
------
// Last line in script
Set vMacroRun = 1;
end if
1 Then make an External task and do a batchreload by using /r. Your macro will run and fetch LOCATION into the variable.
2. Do a regular load that is dependent on the first one being successful. The macro will not run since publisher will not execute it.
A little bit complicated but it should work fine.
Or just run the whole job as an External task fetching your variable on OnPostReload
If the macro fetches the location, why can't you just use it as a function and load it directly in the script? For example in the load script:
LET a = getpath();
LOAD *
FROM $(a) (biff, embedded labels, table is Sheet1$);
where getpath is a function defined as:
Function GetPath ()
GetPath = "..\testfile.xls"
End Function
Regards,
Gordon
i want to execute this same script as vb macro. how about the possibility