Request help with maintaining Flags for individuals
Posted: 19 Nov 2021 15:46
Hello,
I’m writing a plugin to maintain custom Flags on a group of individuals, but I’ve come to the point where I need some help, plz.
I’ve started with three scenarios when adding a new flag:
1. The individual has no flags i.e. no Flags item/attribute in the property page and the INDI record has no _FLGS tag
2. The individual previously had one or more flags that has been deleted, but the (empty) Flags item in the property page persists.
3. The individual has (other) existing flags
For starters I’ve learned that the value of the _FLGS tag is a comma separated list of flag names, and I can read this by using the function fhGetItemText(ptrIndiRecord,'~._FLGS'), and I can then add my new project to the list (scenario 3)
Q1: However, I can’t work out how to set the new value for the _FLGS tag! My logic tells me that the construction below should do it, but alas not.
ptrFlagItem = fhGetItemPtr(ptrIndiRecord,'~._FLGS')
bOK = fhSetValueAsText(ptrFlagItem, strFlagNames)
Q2: Another problem I have, is how to determine if the individual has an existing (empty) Flags item? In scenario 1 i expect i need to create the _FLGS tag first, and link it, before adding it's value,. In both scenarion 1 and 2 the function fhGetItemText(ptrToIndiRecord,'~._FLGS') returns an empty string.
Regards
Erik
I’m writing a plugin to maintain custom Flags on a group of individuals, but I’ve come to the point where I need some help, plz.
I’ve started with three scenarios when adding a new flag:
1. The individual has no flags i.e. no Flags item/attribute in the property page and the INDI record has no _FLGS tag
2. The individual previously had one or more flags that has been deleted, but the (empty) Flags item in the property page persists.
3. The individual has (other) existing flags
For starters I’ve learned that the value of the _FLGS tag is a comma separated list of flag names, and I can read this by using the function fhGetItemText(ptrIndiRecord,'~._FLGS'), and I can then add my new project to the list (scenario 3)
Q1: However, I can’t work out how to set the new value for the _FLGS tag! My logic tells me that the construction below should do it, but alas not.
ptrFlagItem = fhGetItemPtr(ptrIndiRecord,'~._FLGS')
bOK = fhSetValueAsText(ptrFlagItem, strFlagNames)
Q2: Another problem I have, is how to determine if the individual has an existing (empty) Flags item? In scenario 1 i expect i need to create the _FLGS tag first, and link it, before adding it's value,. In both scenarion 1 and 2 the function fhGetItemText(ptrToIndiRecord,'~._FLGS') returns an empty string.
Regards
Erik