# Youseful Software - FileMaker sample script # Script name: Youseful - Query products # Plug-in: YsflQuery.fmx64 (Windows x64) # Setup: Create a Products table occurrence with Name (Text), Category (Text), and Price (Number). Import products.csv from this folder, mapping the header names and excluding the header from records. Commit the three records before running. # Expected: [{"Column1":"Hammer","Column2":"12"},{"Column1":"Saw","Column2":"20"}] (JSON whitespace may differ). # Format: UTF-8 Script Workspace step listing. Add the steps manually; this is not an importable FileMaker file. # Lines beginning with # are notes; optionally add them as Comment steps. # Preserve calculation quotes, backslashes, and paragraph symbols exactly. Set Variable [ $category ; Value: "Tools" ] Set Variable [ $json ; Value: YsflQr_ExecuteSQLEx ( "" ; "SELECT Name, Price FROM Products WHERE Category = ? ORDER BY Name" ; "JSON" ; "" ; "" ; $category ) ] If [ Left ( $json ; 1 ) = "?" ] Show Custom Dialog [ "Query failed" ; $json ] Exit Script [ Text Result: $json ] End If Show Custom Dialog [ "Products" ; JSONFormatElements ( $json ) ]