Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Easier way to "SUM" a boolean
Fri, Oct 2 2015 6:21 AMPermanent Link

Adam Brett

Orixa Systems

I have a record which has a group of child records.

The child records contain a boolean field.

For the master record, if ANY of the child record-boolean fields is true I need to take an action.

At present the best SQL I can write is:

IF('TRUE' IN (REPLACE('FALSE,' WITH '' IN LIST(CAST(SD.ActionRequired as VARCHAR)))) then 8 else 7) as StateID,

This seems heavy-handed, as I would expect there to be some sort of "boolean summing" function available somewhere but I can't see any.
 
Fri, Oct 2 2015 10:08 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< At present the best SQL I can write is: >>

Is that in the SELECT list, or in the WHERE clause ?

<< This seems heavy-handed, as I would expect there to be some sort of "boolean summing" function available somewhere but I can't see any. >>

Are you looking for the count of children with a True Boolean column value, or what ?

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Oct 2 2015 10:09 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

After thinking about it, I think I know what you're trying to do.  However, if you send your existing SQL (and/or table structures), I can tell you exactly what the SQL should be.

Tim Young
Elevate Software
www.elevatesoft.com
Image