* Challenging Expression

Homeless Posts from the old forum system
Locked
User avatar
johnmorrisoniom
Megastar
Posts: 882
Joined: 18 Dec 2008 07:40
Family Historian: V7
Location: Isle of Man

Challenging Expression

Post by johnmorrisoniom » 17 May 2012 17:35

Here's one for someone who is good at creeating expressions (Not Me)
I would like to use an expression to display an icon to show that there are any Individual Census Facts that do not have an image associated with it.
I do not need a different expression for each year, just one icon to show that an individual has at least one census fact with no image (I use AS method 2, but have only just started adding images, so want to go back through all my records)

Any help greatly appreciated

ID:6249

User avatar
tatewise
Megastar
Posts: 27082
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Challenging Expression

Post by tatewise » 17 May 2012 18:11

I assume you are adding images using the Camera icon associated with Facts.

The Expression would be based on the following, but all entered on one line in the Condition:

=IsTrue(
(Exists(%INDI.CENS[1]%) and Not(Exists(%INDI.CENS[1].OBJE>%))) or
(Exists(%INDI.CENS[2]%) and Not(Exists(%INDI.CENS[2].OBJE>%))) or
(Exists(%INDI.CENS[3]%) and Not(Exists(%INDI.CENS[3].OBJE>%)))
)

but will need to be extended to cover CENS[4], CENS[5], et seq, depending how many Census Facts any one Individual may have.

User avatar
johnmorrisoniom
Megastar
Posts: 882
Joined: 18 Dec 2008 07:40
Family Historian: V7
Location: Isle of Man

Challenging Expression

Post by johnmorrisoniom » 17 May 2012 18:26

Thanks Mike,
I had a go myself, and had something similar, but i must have been making a syntax error somewhere, because I kept getting 'Invalid Expression'.
I think 10 census items should cover the majority of cases.
Is there a character limit to expressions, because this is going to be quite long.
I think I'll build in in notepad first, then cut and paste.

Thanks for your help

User avatar
tatewise
Megastar
Posts: 27082
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Challenging Expression

Post by tatewise » 17 May 2012 18:39

Yes, building in Notepad is what I do.

There may be a limit to Expression length, but because this is an or condition, you can split it across several Conditions and get the same effect (I think).
The first Condition Expression to satisfy IsTrue(...) will display the Icon.
But if false, will continue to next Condition Expression...
Might be logical to have one Condition Expression for each Census instance.

User avatar
johnmorrisoniom
Megastar
Posts: 882
Joined: 18 Dec 2008 07:40
Family Historian: V7
Location: Isle of Man

Challenging Expression

Post by johnmorrisoniom » 17 May 2012 20:40

I have strung it all together as one line and it works well, as far as I can tell.

At least I know that my original thinking was along the right lines.
Thanks again

Locked