Your cart is currently empty!
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.
Leave a Reply