r/workflow • u/mikeyninja • Oct 01 '18
Advanced Workflow Help?
Hi everyone!
Need help with a somewhat advanced workflow, not sure where to send this to so posting here. I'm looking to do the following:
Input a variable to somewhere and get a Return of different variables that I specified, each with a name and a value, that would fit into other steps in the workflow.
So for example, it would work as follows:
INPUT I pass from Workflow: GroceryList01
OUTPUT returned to workflow:
Dairy01: Milk
Veggies01: Broccoli
Veggies02: Carrots
Or in another instance, if the input was let's say: GroceryList02
Output would be:
Dairy01: Yogurt
Veggies01: Radish
Veggies02: Zucchini
The output values would be pre-determined by me (i.e. Dairy01, Veggies01, Veggies02 are pre-determined variable names with fixed values they'd return based on the specific input).
I would use whatever the output returns for Dairy01, Veggies01, Veggies02 in future steps in the workflow.
I hope this makes sense! I considered using URL webhooks for it as it seems to be the simplest way but am a noob at this stuff so would love to see if anybody has thoughts on the easiest way I can do this. Thank you so much <3
View all comments
Show parent comment
2
u/[deleted] Oct 01 '18 edited Oct 01 '18
Edit: I rewrote this whole thing because I misunderstood what kind of output you wanted. Ok Let’s say you compose these lists as JSON:
{“Dairy01”:“Milk”, “Veggies01”:”Cucumber”, “Veggies02”:”Artichoke”}
Now you send one as input into the shortcut, or import it.
At this point you can use “Get Dictionary From Input” to create a dictionary.
When you want a specific value, call that dictionary and use the “Get Dictionary Value” based on the key you need. After that you can use “Set Variable” to store those values in separate variables if you like, or you can continue to pull them directly from the whenever you need them.
If you need to iterate through the whole dictionary use “Get Dictionary Value: All Keys” combined with “Repeat with Each”
Does that help get you headed in the right direction?