Function Parameters
Creating Input Parameters
Input parameters help customize a CMS function’s behavior and fine-tune its output.
The values specified in the input parameters can be further used in the function’s body.
For example, if your function outputs a list of items, it may output all of them by default. One way is to limit the number of items to display by editing the function’s template markup. This would be a hard-coded value, which makes your function inflexible in this respect.
The other and better way is to use a variable in the markup that will get its value from an input parameter set by the user of the function.
In C1 CMS, the following functions can have input parameters:
- XSLT functions
- C# inline functions
- SQL functions
Although these functions differ in the language they are created in, they share the parameter types (simple parameters) and the procedure of creating and using the parameters.
To add an input parameter to a function:
- Edit a function.
- Switch to the Input Parameters tab.
- Select List of input parameters and click Add New. The input parameter’s property editor opens on the right.
- Set its properties where required or necessary.
- Click Save.
The values specified in the input parameters can be further used in function calls and the function’s body (XSLT markup, C# code or SQL query).
For information about using parameters within functions, please refer to guides of respective function types.
Now let’s have a better look at the parameter properties.