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:

Screenshot 2023 11 11 at 23 33 40

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:

Screenshot 2023 11 11 at 23 40 49

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:

Screenshot 2023 11 11 at 23 43 21

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:

Screenshot 2023 11 11 at 23 47 02

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:

Screenshot 2023 11 12 at 00 28 47

This means we can use the โ€œchoiceโ€ value in the โ€œcreate cardโ€ action successfully:

Screenshot 2023 11 12 at 00 32 13

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:

Screenshot 2023 11 12 at 00 37 17

ย 

ย 

ย 

ย 

ย 

ย 

ย 


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *