Syntax for updating all other child records except current.

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Syntax for updating all other child records except current.

Post by KnightWare »

Parent (SUITES) / child (TENANT). SUITES owns TENANT.
Suites.Tenant = relationship of all Tenants owned by Suites.
Teant.Suite = relationship from Tenant back to Suite.

During an Create/EDIT of the child (TENANT) , if I turn on a value, on save I want all other children of this parent value turned off. There can be only one active. I have a few rules on the BO to do calculations on save, and then end with check if you have turned this value on. However it's turning all children values off, including the one I just saved. I've tried separating it into a process, but same results.

CONDITION
Tenant.Active = 'YES'

ACTIONS:
1. Find Tenant Where Tenant.Suite = ThisTenant.Suite and Tenant.ID <> ThisTenant.ID
2. Tenant.Active = 'NO'
3. Tenant.Suite.Vacant = 'NO'
4. Tenant.Suite.ActiveTenantNo = Tenant.ID
5. Tenant.Suite.ActiveTenantName = Tenant.Tenant
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Syntax for updating all other child records except curre

Post by KnightWare »

I'll add, that according to the Rules Log, the Find is finding the other child records. It find s a count of child records -1.
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Syntax for updating all other child records except curre

Post by Jaymer »

maybe: https://awareim.com/forum/viewtopic.php?f=1&t=10705

and also read this about 'in batches of 1'
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: Syntax for updating all other child records except curre

Post by KnightWare »

Jaymer - you sir are a genius.
OtherBO
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Syntax for updating all other child records except curre

Post by Jaymer »

glad that helped, but its a group thing - i'm not a genius. everyone knows something that can help someone else.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply