Generate expressions
Use SnapGPT to generate expressions to use in Snaps with expression-enabled fields.
SnapGPT can generate expressions for expression-enabled Snap fields. It uses a catalog of expressions provided by the SnapLogic Professional Services team. For the Mapper Snap, SnapGPT also uses the input schema from available preview data.
This page describes how to use SnapGPT to generate a general expression for a File Read Snap. Map to target and Extract pipeline parameters show how to use SnapGPT with the Mapper Snap.
In pipeline that reads files from an S3 bucket or over SFTP, you might want to retrieve them based on the date they were saved. Assume that the files all have the same name with the current date appended to it. To simplify the example, we'll use the File Reader Snap, which reads from the SnapLogic file system.
To use SnapGPT to generate a general expression:
- In Designer, open the File Reader Snap.
- Below the File field, click the Expression button,
.
- Click the arrow on the right side of the field. If the field has a value, remove it to reveal the
SnapGPT prompt. You can ignore the error message:
- Enter a description. For example: Use a variable for the filename and append the current date.
- Click the SnapGPT icon,
.
In this example, SnapGPT generated a list of five valid expressions: - Click an expression to select it.