Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there any method like a system variable or a function one could use in a load script to capture the name of the section of the load script? In the example shown, I am referring to the names of the sections: Main, Dictionary, and Calendar. I want to use this in the load script in a Trace statement so it will show in my load script log. But any other recommendation would we welcome. I'm hopeful it doesn't have to be manually typed or copied.
From this link to the help information on using Sections to organize a load script: https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/LoadData/organize-script...
Is there a way to get the names of sections? i.e., Main, Dictionary, and Calendar here.
Thanks all!
This is not exactly what you asked for but it accomplishes a similar and more controlled approach to section execution. We encapsulate the code for each script section into its own subroutine. Then, we run them using a FOR EACH loop. This automatically gives us a variable (vCurrentStep) that tracks exactly which section is running.
// 1. Encapsulate each section in a subroutine
SUB Main
// <Code for Main goes here>
END SUB;
SUB Dictionary
// <Code for Dictionary goes here>
END SUB;
// 2. Loop through and execute them dynamically
FOR EACH vCurrentStep IN 'Main', 'Dictionary', 'Calendar'
// Log the name of the current subroutine to the progress window
TRACE >>> ========================================;
TRACE >>> Now Running Step: $(vCurrentStep);
TRACE >>> ========================================;
// Execute the subroutine
CALL $(vCurrentStep);
This is not exactly what you asked for but it accomplishes a similar and more controlled approach to section execution. We encapsulate the code for each script section into its own subroutine. Then, we run them using a FOR EACH loop. This automatically gives us a variable (vCurrentStep) that tracks exactly which section is running.
// 1. Encapsulate each section in a subroutine
SUB Main
// <Code for Main goes here>
END SUB;
SUB Dictionary
// <Code for Dictionary goes here>
END SUB;
// 2. Loop through and execute them dynamically
FOR EACH vCurrentStep IN 'Main', 'Dictionary', 'Calendar'
// Log the name of the current subroutine to the progress window
TRACE >>> ========================================;
TRACE >>> Now Running Step: $(vCurrentStep);
TRACE >>> ========================================;
// Execute the subroutine
CALL $(vCurrentStep);
I don't know of any way to get the name of the current section in load script. You could set a variable manually at the top of each section.
Set vSectionName = Dictionary;
Trace 'Starting Section: $(vSectionName)';
-Rob
Thank you, another very good choice!