refers
http://c.raqsoft.com/article/1687916213139
In addition to common static code, sometimes dynamic code is also needed to solve problems, such as generating code (or part of code) based on parameters and dynamically executing it. For programming languages that lack dynamic coding mechanisms, it is usually necessary to write the variable parts of the code in string form. For example, when referencing dataset field names in Python, it is necessary to write them as strings to achieve the effect of dynamic code. However, this will make it inconvenient to read and write more common static code. SQL, on the other hand, can directly write field names (as well as filter conditions, grouping expressions, etc.) in the code without having to write them into strings, making it easier to read and write static code, but it is difficult to handle dynamic code.
SPL inherits the SQL style of static code, allowing for direct writing of code parts, such as field names, without the need to be written as strings. In addition, SPL also provides macros to achieve dynamic code effects.
Example 1: Dynamically sort the order table based on the parameter pSortList, which contains an indefinite number of sorting fields separated by commas.
This dynamic code can be implemented using SPL macros: T("Orders.txt").sort(${pSortList})