Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
dreavis
Contributor
Contributor

Load Script Section Name?

 

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.Is there a way to get the names of sections? i.e., Main, Dictionary, and Calendar here.

Thanks all!

Labels (1)
1 Solution

Accepted Solutions
JonCarpenter
Luminary
Luminary

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);

 

View solution in original post

3 Replies
JonCarpenter
Luminary
Luminary

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);

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

dreavis
Contributor
Contributor
Author

Thank you, another very good choice!