Page 1 of 1

set flag based on fact

Posted: 22 Sep 2020 22:04
by TMG_refugee
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?

Re: set flag based on fact

Posted: 23 Sep 2020 06:18
by johnmorrisoniom
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

Re: set flag based on fact

Posted: 23 Sep 2020 10:22
by tatewise
For background advice see how_to:using_flags_and_icons_and_expressions|> Using Flags and Icons and Expressions.

Re: set flag based on fact

Posted: 23 Sep 2020 14:01
by TMG_refugee
John,

Thank you that worked perfectly.