GenoPro Home
GenoPro Home  |  Get Started With My Genealogy Tree  |  Buy  |  Login  |  Privacy  |  Search  |  Site Map
 
PhPlaceDescription


https://support.genopro.com/Topic34912.aspx
Print Topic | Close Window

By Nand - Monday, April 13, 2015

Context: English Narrative Report version 2015.04.02

Phrase: PhPlacedescription

 

I have a number of situations where I need to generate a phrase containing only the “place name” (P0) and the “county or region” (P4).

 

Instead of digging into the current PhPlaceDescription phrase and risking to screw everything up, I decided to use the if-then-else approach. 

 

The first part of the phrase would be limited to the situation where only P0 and P4 would be present, followed by the original phrase that would cover the else condition.

 

Something like:

 

[{?!1}[{?!2}[{?!3}[{?4}[{?!5}[{?!6}[{?!7}<Case where only P4 is present>]]]]]]]

[{!}<Unchanged default phrase>]

 

The "P0-and-P4-only" case triggers correctly and produces the expected output, but strangely enough this seems to change the way the standard phrase behaves.

 

If I load the following into the phrase editor tool, the presence/absence of the last parameter seems to influence the whole phrase.

 

[{?!1}[{?!2}[{?!3}[{?4}[{?!5}[{?!6}[{?!7} *** {!13h}{!0}{!14h} {4} ***]]]]]]]

[{!}{!13h}{!0}{!14h} is[ {1}][{?2} at {2}][{?3|4|5|6|7}[{?2},][{!} in][ {3h}][[{?2|3},] {4h}][[{?2|3|4},] {5h}][ {7h}][ {6h}][{?11|12}[{?2|3|4|5|6|7} and is] located at[ latitude {11}][[{?11},] longitude {12}]]].{\br}]

 

Notes:

  1. The asteriscs “***” are only used to make the result stand out and easier to find in the output of the phrase editor.
  2. I limited the condition to the first 7 parameters for ease of testing and to keep it readable.

Any ideas?

By Nand - Monday, April 13, 2015
An example will probably help:



In short, when argument 7 (the country) is missing, no output is generated.
By genome - Monday, April 13, 2015
The phrase generator's [{!}} or 'else' doesn't work well with nested conditions.  It seems to be an 'else' clause for the inner most condition ie. {?!7}.

After much messing around I came up with:
[{!13h}{!0}{!14h} [[{?!2|3|5|6|7|8|9|10|11|12}*** {4} ***][{!}is[ {1}][{?2} at {2}[{?3|4|5|7},]][{?!2}[{?3|4|5|6|7} in]][{?3} {!3}[{?4|5|7},]][{?4} {4h}[{?5|7},]][{?5} {5h}[{?4|5|7},]][ {7h}][ {6h}]][{?11|12}[{?2|3|4|5|6|7} and is] located at[ latitude {11}][[{?11},] longitude {12}]]].{\br}]

Also found in testing this I needed to change my default PhPlaceDescription to avoid consecutive commas in some cases.
By Nand - Monday, April 13, 2015
Yes, I suspected the {?!7} also.

Thanks Ron.  This works OK for me.
By genome - Tuesday, April 14, 2015
I'm happy to have the  P0 P4 variant in the default phrase so I have ended up with the following for the next update
 
PhPlaceDescription [{!13h}{!0}{!14h} [[{?!1|2|3|5|6|7}{4}][{!}is[ {1h}][{?2} at {2h}[{?3|4|5|7},]][{?!2}[{?3|4|5|6|7} in]][{?3} {!3h}[{?4|5|7},]][{?4} {4h}[{?5|7},]][{?5} {5h}[{?4|5|7},]][ {7h}][ {6h}]][{?11|12}[{?2|3|5|6|7} and is][{?4} is] located at[ latitude {11}][[{?11},] longitude {12}]]].{\br}]

PhPlaceDescriptionTxt {!0} [[{?!1|2|3|5|6|7}{4}][{!}is[ {1}][{?2} at {2}[{?3|4|5|7},]][{?!2}[{?3|4|5|6|7} in]][{?3} {!3}[{?4|5|7},]][{?4} {4}[{?5|7},]][{?5} {5}[{?4|5|7},]][ {7}][ {6}]][{?8|9}[{?2|3|5|6|7} and is][{?4} is] located at[ latitude {8}][[{?8},] longitude {9}]]].