Getting Started¶
This short guide walks through writing and running a minimal Branchline transform.
Write your first transform¶
Create a file hello.bl with the following contents:
The transform reads the implicit input record, builds a new field, and emits it with OUTPUT.
Run the transform¶
You can execute Branchline from Kotlin using the test utility compileAndRun:
val result = compileAndRun(
body = """
LET greet = \"Hello, \" + input.name;
OUTPUT { greeting: greet };
""".trimIndent(),
input = mapOf("name" to "Branchline")
)
println(result) // {greeting=Hello, Branchline}
The helper compiles the snippet and runs it against the provided input map.
Try it in the playground¶
Open the playground with the starter example preloaded: customer-profile.
Expected output for the starter example:
Change the input JSON and rerun to see the output update. Enable tracing to view EXPLAIN provenance for variables you care about.
Next steps¶
- Edit the program to add a field (e.g., loyalty tier label) and confirm the output changes.
- Switch the input format to XML in the playground and try the
junit-badge-summaryexample to see XML parsing. - Read the Language Overview for syntax details and explore the stdlib pages linked to interactive examples.