* set flag based on fact

Writing and using plugins for Version 5 and above.
Post Reply
avatar
TMG_refugee
Platinum
Posts: 37
Joined: 14 Nov 2015 15:44
Family Historian: V6.2

set flag based on fact

Post by TMG_refugee » 22 Sep 2020 22:04

I am trying to create a chart that will show all the people who have a genetically transferred disease.
So far I have been able to create a new fact and add that fact to each person who shows this disease. I have also manually set a new flag for each of these people.

On the chart I show the note for that new genetic fact. I have also set the background color for each person with the disease ( the new flag) to a unique color. All is good and shows what I want.

I would like to know if there is any way to set that new flag based on the presence of that genetic disease fact type automatically? It appears that a plugin might do the job but I have not seen a plugin that will do this in particular. I am new to FH and I have not written any plugins and was wondering if anyone has attempted this and could offer some advice on if a plugin exists and if not how I would go about writing one?

User avatar
johnmorrisoniom
Megastar
Posts: 792
Joined: 18 Dec 2008 07:40
Family Historian: V6.2
Location: Isle of Man

Re: set flag based on fact

Post by johnmorrisoniom » 23 Sep 2020 06:18

You don't need to add the flag at all.
Because you are adding a fact about the disease, the diagram options can be set to test for the existence of the fact itself, and set the background colour accordingly (Or add an Icon).

In the boxes section of Diagram Options select add condition

add an expression to check your fact exists

Code: Select all

=Exists(%INDI._ATTR-TO_DO%)
(My expression tests for a ToDo Fact) substitute the code for your fact using the insert data ref button and click OK
Choose what feature you want to use

User avatar
tatewise
Megastar
Posts: 18938
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: set flag based on fact

Post by tatewise » 23 Sep 2020 10:22

Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

avatar
TMG_refugee
Platinum
Posts: 37
Joined: 14 Nov 2015 15:44
Family Historian: V6.2

Re: set flag based on fact

Post by TMG_refugee » 23 Sep 2020 14:01

John,

Thank you that worked perfectly.

Post Reply