Updating while creating

Hello Folx,

I’m hoping there is a simple solution to what I’m trying to do and that I’m just being daft.

Anyways, I have an AnimalCategoryHistory table where new records = animals moving to a new Category (heard/mob here in Australia). The new record has a StartDate and an empty EndDate. How, in Bubble, do I update the previous Category’s record with an EndDate, upon the creation of a new one?

Thank you so much in advance. I appreciate any help with this.

Miesha.

You just need to find the appropriate record, and update it…

How you do that depends on how you’ve set up your database (and what you’re doing in your app)… but probably just search for a AnimalCategoryHistory, who’s Animal is the animal in question, and who’s EndDate is empty.

1 Like

I was thinking I might be able to run two workflows simultaneously (never done that before but seems plausible as I’m typing this), one to do the update on the Current Screen’s Animal, and another to do a create with the new Category. I suppose it depends on the business logic. I could just have an explicit “close/end” workflow, and then a “chose new Category” workflow, but I like the idea of auto-ending the previous category when a new Category is chosen.

Just re-read your reply. That’s actually good. I think I can just use a conditional to find that empty value. If it’s empty, that’s the last record for that Animal. Indeed… Thank you. I think this has steered me nicely.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.