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.
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.
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; //
// Your regular script
// Last line in script
Set vMacroRun = 1;
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();
FROM $(a) (biff, embedded labels, table is Sheet1$);
where getpath is a function defined as:
Function GetPath ()
GetPath = "..\testfile.xls"