Hi,
I just came across this function in the manual:
=ItemIf(%INDI.SEX% = 'Male',%INDI.FAMS>WIFE%,%INDI.FAMS>HUSB%)
Which works pretty fine, but then I thought I'd prefer to have the surname first, and then the given name, and tried to change it to this (in two query columns):
=ItemIf(%INDI.SEX% = 'Male',%INDI.FAMS>WIFE>NAME:SURNAME%,%INDI.FAMS>HUSB>NAME:SURNAME%)
=ItemIf(%INDI.SEX% = 'Male',%INDI.FAMS>WIFE>NAME:GIVEN_ALL%,%INDI.FAMS>HUSB>NAME:GIVEN_ALL%)
The terms are accepted by the software, however the result in all three cases is just showing the standard individual form, like John MILLER, in the field.
Also, I tried to apply the same to the RecordID, which I thought should have this form then:
=ItemIf(%INDI.SEX% = 'Male',=RecordId(%INDI.FAMS>WIFE>%),=RecordId(%INDI.FAMS>HUSB>%))
But that term is not accepted at all by the program.
Any ideas?
TIA
Sabine
ID:5406
* Conditional expression in query
- Jane
- Site Admin
- Posts: 8440
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Conditional expression in query
Hi Sabine,
Try using textif rather than itemif, as with a qualifier the NAME:SURNAME is text rather than a item (field)
On the last one remove the extra = and I think it will work.
=TextIf(%INDI.SEX% = 'Male',RecordId(%INDI.FAMS>WIFE>%),RecordId(%INDI.FAMS>HUSB>%))
Try using textif rather than itemif, as with a qualifier the NAME:SURNAME is text rather than a item (field)
On the last one remove the extra = and I think it will work.
=TextIf(%INDI.SEX% = 'Male',RecordId(%INDI.FAMS>WIFE>%),RecordId(%INDI.FAMS>HUSB>%))
Conditional expression in query
Hi Jane,
as usual, you've got it. Thank you!
The lines now are like this:
(for the surname)
=TextIf(%INDI.SEX% = 'Male',%INDI.FAMS>WIFE>NAME:SURNAME%,%INDI.FAMS>HUSB>NAME:SURNAME%)
(for the given names)
=TextIf(%INDI.SEX% = 'Male',%INDI.FAMS>WIFE>NAME:GIVEN_ALL%,%INDI.FAMS>HUSB>NAME:GIVEN_ALL%)
(for the IRN)
=TextIf(%INDI.SEX% = 'Male',RecordId(%INDI.FAMS>WIFE>%),RecordId(%INDI.FAMS>HUSB>%))
Until today, I had not been aware of the fact that one could build queries with if-expressions in it. That should be very helpful in the future!
Sabine
as usual, you've got it. Thank you!
The lines now are like this:
(for the surname)
=TextIf(%INDI.SEX% = 'Male',%INDI.FAMS>WIFE>NAME:SURNAME%,%INDI.FAMS>HUSB>NAME:SURNAME%)
(for the given names)
=TextIf(%INDI.SEX% = 'Male',%INDI.FAMS>WIFE>NAME:GIVEN_ALL%,%INDI.FAMS>HUSB>NAME:GIVEN_ALL%)
(for the IRN)
=TextIf(%INDI.SEX% = 'Male',RecordId(%INDI.FAMS>WIFE>%),RecordId(%INDI.FAMS>HUSB>%))
Until today, I had not been aware of the fact that one could build queries with if-expressions in it. That should be very helpful in the future!
Sabine
- Jane
- Site Admin
- Posts: 8440
- Joined: 01 Nov 2002 15:00
- Family Historian: V7
- Location: Somerset, England
- Contact:
Conditional expression in query
There was a whole raft of new functions added to V4, including the 'if' functions and the ability to use AND OR NOT etc along with them.