NOTICEXanoScript is in beta and it is strongly recommended that you do not use it in production at this time.While there should be significant parity between the visual builder and XanoScript, we are still fine-tuning and adjusting XanoScript, and breaking changes may be introduced.
Navigation
Introduction
Key Concepts
XanoScript - Database
XanoScript - Functions and APIs
XanoScript - Background Tasks
XanoScript Function Reference
XanoScript Filter Reference
Core Data Types
Numbers
IntegersWhole numbers like 1, 2, 3, and -5
DecimalsNumbers with fractional parts like 1.23, 0.5, -10.7
Text
Simple TextText must be wrapped in double or single quotes.Alternative text syntax if you need a line with the triple double quotes
Escaping QuotesEscape characters are required when using single or double quotes inside of a text string.
Complex Data Types (JSON)XanoScript automatically chooses the most readable quote style for your text. It uses double quotes by default, but switches to single quotes when your text contains double quotes (like JSON data). This makes JSON strings much cleaner and easier to read in your code.This is problematic and hard to read.This is how XanoScript handles it.
Multiline TextXanoScript supports multiline text using triple quotes (Important: Multiline text defined using
"""). This allows you to write text across multiple lines without needing escape characters for line breaks.The indentation of the closing """ determines the common whitespace that is removed from each line of the text. This is similar to multiline string handling in YAML, and it allows you to maintain the text block’s position within your code without needing to left-align every line.""" cannot be used directly with filters or transformations. If you need to apply filters or transformations to multiline text, you must use escaped line break characters () instead."Dear John,\nYour order will arrive by Friday.\nRegards,\nCustomer Service"|to_upperBoolean (true/false) Values
True / FalseBooleans are special values that, while presented as text, do not require quotes.
Date & Time
Standard Date & Time FormatXanoScript uses a standardized format for timestamps: This represents December 09, 2024 at 5:37.42 PM in UTC time.It’s important to note that XanoScript does not plainly support the Unix EPOCH format that you might be used to when working in Xano. XanoScript can’t tell the difference between a timestamp and a regular integer.
YYYY-MM-DD HH:MM:SS+ZZZZ. This format includes the date, time, and timezone offset.Complex Data Types
ObjectsObjects can be written in XanoScript using Standard JavaScript syntax works perfectly.Commas are not required, but XanoScript also supports trailing commas.
` characters.ArraysArrays can be written in XanoScript using ` characters.Standard JavaScript syntax works perfectly.Commas are not required, and XanoScript also supports trailing commas.
Expressions
Xano’s Expression data type is fully supported in XanoScript. Expressions should be wrapped in` characters.
```
Type Casting
Type casting is the optional process of preceding a value with its intended type, such as one from the list below.| Data Type | Cast |
|---|---|
| Number | !int |
| Text | !text |
| Boolean | !boolean |
| Decimal | !decimal |
| null | !null |
| Array | !array |
| Object | !object |
| Expression | !expr |
| Timestamp | !timestamp |
- Casted values do not support multi-line text. You will want to use line break characters.
- All casted values only operate on text strings, so each value must be wrapped inside quotes.
Valid Type Casting
Invalid Type Casting
Variables
All variable references must start with a$.