Part 14: Hiding card slots with no cards played

Iโ€™m still working on getting a playspace runnning. ย New updates include creating repeaters for each of the location areas for each player – 4 slots per player per location.

To do this, Iโ€™ve augmented the Game instatiation flows so that each location automatically creates 4 slot records per player – in the last update I said I wouldnโ€™t rely on repeaters, but given I know that we will have a hard-limit on the slots, itโ€™s ok if my renderer is based on repeaters that have Data resources for each player and location combination ordered by slot number.

Each of these slots will also show the card image – however I need a way to hide the card image if thereโ€™s no card (so the component isnโ€™t empty).

My first instinct was to script the โ€œHide componentโ€ configuration based on the value in the card_instance field for the slot. ย This worked with a bit of messing around, but at this point Iโ€™ve violated my โ€œno codeโ€ guideline again:

ย 

In order to turn this into a no-code situation, Iโ€™ll need to have a boolean somewhere that tells the UI whether to render the slot or notโ€ฆ. I can put that on the slot record:

This is a bit of a pain, because I have 6 Data Resources that havenโ€™t yet got that new field available, then I have 6 repeaters that I need to update with the item mapping. ย When youโ€™re creating a playspace with lots of instances of the same type of data the Data Resource mapping can get a little complex to update using the UI Builder interface. ย Hopefully some of this gets a little easier in ServiceNow in future – it can take a while to render the parts I need to update or parts of the UI can be annoying to get to (excessive scrolling or clicks to get to the parts I need). ย That said, itโ€™s proving to be quite โ€œno-codeโ€ friendly to acheive outcomes, and quite flexible. ย Iโ€™m suspecting that Iโ€™ll have a lot of performance issues due to my reliance on data resources and watchers, but at least weโ€™re getting things done relatively well.

When I set my Visibility data mapping to the repeater Item, I needed to reverse the logic – E.g. my slot says โ€œSlot Visible = falseโ€ which means that the โ€œhide componentโ€ data mapping needs to be โ€œ! Slot Visible = trueโ€:

This gets me to the point where I can hide the โ€œunusedโ€ slots without having to resort to any code! ย Iโ€™m still at the point where the only code Iโ€™ve written is a Card Shuffling action in Flow Designer. ย UI Builder is still no code at this point.


Comments

Leave a Reply

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