Page 1 of 1

Stacked Conditional Operators?

Posted: 15 Sep 2017 19:31
by stewartrb
What I had:
=ExistsText(%INDI.DEAT[1+]%,"✝") %INDI.DEAT[1+].DATE:COMPACT% in %INDI.DEAT[1+].PLAC:TIDY%

But I want it nuanced:
=TextIf(%INDI.DEAT[1+]%, TextIf(HasFlag(%INDI%, "KIA"), "⚔", "✝")) %INDI.DEAT[1+].DATE:COMPACT% in %INDI.DEAT[1+].PLAC:TIDY%

(Which doesn't work.)

Basically, I want the ✝ if I have death info, but I want to change it to ⚔ if the individual is flagged as killed in battle.

Re: Stacked Conditional Operators?

Posted: 15 Sep 2017 19:57
by tatewise
You are nearly there Stewart.
The =TextIf(...) needs its first parameter to be boolean (true/false), so use Exists(%INDI.DEAT[1+]%)
e.g.
=TextIf( Exists(%INDI.DEAT[1+]%), TextIf( HasFlag(%INDI%,"KIA"), "⚔", "✝" ) , )

Re: Stacked Conditional Operators?

Posted: 15 Sep 2017 20:51
by stewartrb
They do stack.

Thanks.

Re: Stacked Conditional Operators?

Posted: 16 Sep 2017 08:45
by tatewise
You could also persevere with your original simpler expression:

=ExistsText( %INDI.DEAT[1+]%, TextIf( HasFlag(%INDI%,"KIA"), "⚔", "✝" ) )

BTW: If you don't record multiple Death Events the [1+] looping index is not needed, so just use:
=ExistsText( %INDI.DEAT%, TextIf( HasFlag(%INDI%,"KIA"), "⚔", "✝" ) ) %INDI.DEAT.DATE:COMPACT% in %INDI.DEAT.PLAC:TIDY% which defaults to INDI.DEAT[1] throughout.