Functions are the building blocks of logic. They can be used to perform actions, such as retrieving a record from the database, or generating a random number.
Hover over a node and click the plus icon to insert a new function after it. You can also hover over the connecting lines to insert a function at that point in the flow.
Adding new functions
In the panel that opens on the right, you can select the function you want to add. Use the search at the top, or navigate through the function categories.
Each function will have a different set of options available to you, so it’s best to consult that function’s specific documentation for more information.
Add a function by clicking the + Add Function button below the function stack, hover over a function and click the + sign, or use your up and down arrow keys to select a row, and press A on your keyboard to add a new function.
In the panel that opens on the right, you can select the function you want to add. Use the search at the top, or navigate through the function categories.
Each function will have a different set of options available to you, so it’s best to consult that function’s specific documentation for more information.After you add a function, Xano will sometimes suggest the most likely next step; for example, adding a Query All Records will suggest a loop after. You can choose to add the suggestion, ignore it, or just continue working and Xano will dismiss the suggestion automatically.
Functions are defined in the stack block, placed immediately after the declaration and accompanying parameters, such as the description.
Example of the stack block and positioning
stack { db.query user { search = $db.user.name ==? $input.name return = {type: "list"} } as $model}
Functions begin with a namespace — basically, a category that the function is a part of. Each namespace is followed by a period, with the function name immediately after. After that, you’ll declare any parameters the function requires. Functions can also have a description, which is optional.