@yusaney1 has presented a solution. The solution however involves creating a custom plugin which I believe is quite a bit of overhead and work to just to add the logic you presented in your question.
Iām sure there is a purely Bubble solution that someone could present. The part that is a bit tricky to work with in Bubble presently is combining pieces of logic. Coming from a technical background, as you seem to be having presented Python code, one of the first plugins I add to every project is the āToolboxā plugin. The toolbox plugin allows us to inject javascript into our Bubble app as needed. A small amount of scripting, in the right places, can go along way to creating workflows that are not convoluted with Bubble āwork aroundsā.
Keep in mind, the entire point of using Bubble is to write as little code as necessary. In other words, try to implement as much logic as you can within the Bubble workflows.
With that being said, I would use a combination of āonly whenā workflow logic and a small bit of Javascript, using the āServer Scriptā action from the Toolbox plugin, to accomplish your goal.
Here is an example setup of how to use only when and get a property value from an object.
What is happening inside of that Node script box, Iāll mostly leave for you to search the forums and do some reading. However, as it pertains to this question, you will need to understand how to grab the property from your object. Bubble basically stores the properties as the field name, suffixed by the property type. So my person data type has a field named age and it is defined as a number, hence āpersons[0].age_numberā. However, if you want to be sure of the properties on your data type you can always send the properties out to a text object on your page for debugging using JSON.stringify(persons);
Finally, you can chain these together to create the logic you need above using the "Result of previous step like this:
Hopefully this gets you on your way.