Passing data to workflows

Total beginner here. I have this functioning finally, but the way I got it to work is surely not ideal.

In the app there are dropdown menus to refine the dates/data you want to view:

All gives you all data.
Yearly would make so that your Year dropdown below is what defines the date range.
Monthly would make it so that the Year and the Month dropdowns define the date range.
(I am thinking of changing this to a Tabbed Container or Cascader for better UI )
searchdropdowns

Each dropdown selection triggers a new state for its corresponding variable (not sure I needed a variable as middle man before passing along, but that's how I got it to work). So I need to pass these selections/stored variable states into my Workflow. I did it like this:
datatopass

So then into the Workflow, I call them in a sql query like this:
sqlquery

Is this the standard/ideal approach? I saw another post here that didn't even mention using the startTrigger method to access data passed from the app to a workflow.

Thanks in advance!

I probably provided too much context and eyes glazed over reading the orig post.

Put another way: is the only (or ideal) way to pass variables/data from the app to a Workflow via the 'startTrigger.data' functionality?

Thanks.

Hi @merritt ,

Using startTrigger.data is a totally valid approach and we see this pattern across many workflows. An alternative is that you can have a block named 'params' where you validate that the data from the startTrigger is as you expect, and then subsequently use params.data in the rest of your workflow.

Best,
Eric

1 Like

Any tips on how I might access one of the passed through data within a python block in a workflow? So far the usual syntax isn't working.

At the top of the script I'm simply trying to set a variable to equal the passed through data value.

ie:

new_var = {{startTrigger.data.xyz}}

Cheers,

Hi @merritt

Sorry that I missed your message all that time ago. In python blocks, you don't need double curlies, so if you try

new_var = startTrigger.data.xyz

that should work.

Eric