Your cart is currently empty!

Part 10: Getting Location and Summon Cards – refactoring my integration subflow
So far with the Marvel Snap app, weโve been retrieving character cards. ย Before we start looking at how to shuffle a game, weโll need to retrieve Location Cards so we can use them in our game.
Weโve already created a Retrieve Marvel cards Integration hub action which hits the API that weโve been working with. ย We started looking at the additional card types at some point, but we never set them up properly. ย Weโve got the โloop behaviourโ for the Character records, and thatโs looking suspiciously like a reusable subflow:
Now ideally Iโd want to turn items 3-6 into a reusable subflow. ย Thereโs supposed to be a new feature in Vancouver that lets me do that – select multiple items and create a subflow. ย What does docs say about that? ย hmmโฆ ok I need to use the โSelect Multpleโ option from the Action section – not super obvious, but cool letโs try that:
Letโs try to convert the whole loop (steps 1-5) and see what happens – we get to name the new flow, but not define inputs yet:
Ok we can work with this. ย Letโs define the input for this new subflow. ย We need theโฆ. card type only really. ย Letโs try that. ย All I really need to do here is rename the API call and make sure itโs grabbing the type from the input:
Ok, so we have a little problem – the API returns the type with a capital letter, but our choice values (on the target table) are lowercase. ย Annoyingly weโre going to need to transform this stuff. ย Letโs build a Decision Table via decision table – we can use our native choice values, then translate them to the โSummon/Location/Characterโ strings that the API expects:
This means we can use the โchoiceโ value in the โcreate cardโ action successfully:
Alright, this is working ok. ย Right now this is going to create records every time itโs run. ย In future we probably wnat to direct this through something like a transform map to make sure that updated data is based on correlated reocrds – currently it will re-create records that we already have, but for now this will help me get my Location and Summon cards into the card database.
Back on our original Subflow (even though weโre not going to run it right now) we can update to call the same subflow with different inputs three times and grab all our data – the parent flow is simplified, and the subflow is just called 3 times:
ย
ย
ย
ย
ย
ย
ย
Leave a Reply