Update Field Based on Another Field in Table

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Update Field Based on Another Field in Table

Post by rpierce » 2022-04-25 15:59

Hello AppGini family,

I have a question that has probably already been asked and answered, but I can't find it.

I have a table that includes a "closed" field that is a radio button with the options of Yes and NO. This is a required field.
There is another field called "close_date". It is not required and default value is null or empty.

What I want to do is remove the Required parameter from the "closed" field and automatically update the field to "Yes" if the "close_date" field is a non null value and to "No" if the close_date field is a null value.

I hope someone can help.

Ray

tchandra
Posts: 13
Joined: 2019-09-22 16:52

Re: Update Field Based on Another Field in Table

Post by tchandra » 2022-05-10 10:24

you can use calculated field to automatically assign closed to yes if closed_date is not null

closed_date as date, no default
closed as calculated field, read only with calculated field below :
SELECT IF(ISNULL( `TABLENAME`.`closed_date`),0,1)
FROM `TABLENAME`
WHERE `TABLENAME`.`id`='%ID%'

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Update Field Based on Another Field in Table

Post by rpierce » 2022-10-07 23:13

Hi tchandra,

I have tried using the calculated field as you suggest, but it just leaves the field blank. I have changed the SELECT IF(ISNULL( `TABLENAME`.`closed_date`),0,1) to SELECT IF(ISNULL( `TABLENAME`.`closed_date`),No,Yes) and no luck.

Any ideas?

Thanks

rpierce
Veteran Member
Posts: 255
Joined: 2018-11-26 13:55
Location: Washington State

Re: Update Field Based on Another Field in Table

Post by rpierce » 2022-10-07 23:55

I got it figured out. Thank you!

Post Reply