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

GenoPro Support Forum




PhPlaceDescription

Click to view RSS...
Author Could use some help with coding
Posted Monday, April 13, 2015 - Post #34912
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 10 hours ago
Posts: 472, Visits: 3,203

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?

Posted Monday, April 13, 2015 - Post #34914
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 10 hours ago
Posts: 472, Visits: 3,203
An example will probably help:



In short, when argument 7 (the country) is missing, no output is generated.
Posted Monday, April 13, 2015 - Post #34915
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Customers
Important Contributors
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 9 hours ago
Posts: 3,339, Visits: 25,605
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.


'lego audio video erro ergo disco' or "I read, I listen, I watch, I make mistakes, therefore I learn"
Posted Monday, April 13, 2015 - Post #34916
Famous Writer

Famous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous WriterFamous Writer

Customers
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 10 hours ago
Posts: 472, Visits: 3,203
Yes, I suspected the {?!7} also.

Thanks Ron.  This works OK for me.
Posted Tuesday, April 14, 2015 - Post #34918
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Customers
Important Contributors
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 9 hours ago
Posts: 3,339, Visits: 25,605
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}]]].



'lego audio video erro ergo disco' or "I read, I listen, I watch, I make mistakes, therefore I learn"


Edited: Tuesday, April 14, 2015 by genome


Similar Topics

Click to view RSS...
Expand / Collapse

Reading This Topic

Expand / Collapse