Skip to content

Instantly share code, notes, and snippets.

@alexandramartinez
Created July 28, 2025 13:10
Show Gist options
  • Select an option

  • Save alexandramartinez/88723e3d977e854b5390cc863ccd9328 to your computer and use it in GitHub Desktop.

Select an option

Save alexandramartinez/88723e3d977e854b5390cc863ccd9328 to your computer and use it in GitHub Desktop.
%dw 2.0
output application/java
var completed = attributes.queryParams.completed
var dueDate = attributes.queryParams.dueDate
var whereClause = if (isEmpty(completed) and isEmpty(dueDate)) "" else "WHERE " ++ (
[
("completed = $completed") if (!isEmpty(completed)),
("dueDate = $dueDate") if (!isEmpty(dueDate))
] joinBy " AND "
)
---
"SELECT * FROM tasks $whereClause"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment