NO.21 A data architect needs to develop a script to export tables from a model based upon rules from an independent file. The structure of the text file with the export rules is as follows:
These rules govern which table in the model to export, what the target root filename should be, and the number of copies to export.
The TableToExport values are already verified to exist in the model.
In addition, the format will always be QVD, and the copies will be incrementally numbered.
For example, the Customer table would be exported as:
What is the minimum set of scripting strategies the data architect must use?
The data architect will need to use a single loop to iterate through the rows of the independent file containing the export rules. Within the loop, they will need to use a SELECT CASE statement to determine which table in the model to export based on the TableToExport value in the current row of the independent file. They can then use the StoreAsFilename value to determine the target root filename, and the NumberOfCopies value to determine the number of copies to export.
This approach makes use of a single loop to iterate through the rows of the independent file, and a SELECT CASE statement to determine which table to export based on the TableToExport value in the current row. It is the most efficient way to accomplish the task with minimal scripting.
You can find the Qlik scripting documentation for Store statement here: https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Scripting/ScriptPrefixes/Store.htm and SELECT CASE statement here: https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Scripting/ScriptStatements/Select.htm