Templating in Queries

Hi there - is there a way to use templating in queries? For example, is it possible to do (1) for loops (2) complex switch statements? I couldn't think of an obvious way to do it using the {{ }} functionality other than simple ternary operators, but I could be missing something.

Thanks!

Hey @huang3r!

There are a few ways you might be able to accomplish this:

  1. Export your logic to an external transformer or JS query that you can reference in the query.
  2. Use preloaded JavaScript to define a function that contains the logic you'd like to use.
  3. Use an IIFE to get around the single-line requirement for transformers:

Can you let me know if any of those work in your case?

1 Like

Great thanks, those make sense and am using a variation of those. Just wanted to make sure I wasn't missing something obvious like Jinja is available.