* GetLabelledText to be case sensitive

For existing requests please see The Wish List
Post Reply
User avatar
davidf
Famous
Posts: 235
Joined: 17 Jan 2009 19:14
Family Historian: V6.2

GetLabelledText to be case sensitive

Post by davidf » 05 Dec 2019 00:14

Been using this useful function to manage some custom facts "Voyage Arrival" and "Voyage Departure" but
=GetLabelledText(%FACT.NOTE2%,"Embarkation Port: ") will also pickup "Disembarkation Port" because the function is not case sensitive!

If I am careful I can avoid problems resulting from this in this context, but it is a potential trap for others in other circumstances.

I cannot see any disadvantage in the function not being case sensitive.
David
Running FH 6.2.7. Under Wine on Linux (Lubuntu 18.04 LTS)

User avatar
tatewise
Megastar
Posts: 16884
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: GetLabelledText to be case sensitive

Post by tatewise » 05 Dec 2019 09:31

There is a similar scenario for =ContainsText(...) that is also case insensitive.

The benefit of being case insensitive is exactly that. The user does not have to be careful about ensuring the text to match in both the function parameter and the database have exactly the same case.

Clearly the behaviour of such functions cannot be altered retrospectively, as that may disrupt existing user Queries, etc.

However, an extra optional boolean parameter to govern case sensitivity would be feasible.
e.g.
=GetLabelledText(%FACT.NOTE2%,"Embarkation Port: ",true)

where Parameter 3 defines whether matches are case sensitive and defaults to false for backward compatibility.

=ContainsText(...) could have a similar Parameter 4 and also a Parameter 5 to match whole words.

Would this be a workable solution?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
davidf
Famous
Posts: 235
Joined: 17 Jan 2009 19:14
Family Historian: V6.2

Re: GetLabelledText to be case sensitive

Post by davidf » 05 Dec 2019 14:45

Yes, that is probably a good compromise.

I had pondered whether such an option might be held as a user preference - which allows compatibility within a user's set-up.

Your solution would mean that if someone had been "sloppy" (pejorative - I know) in entering "Embarkation Port" and "embarkation port" could select the other value for parameter 3 - but would then be caught with "disembarkation port" and "Disembarkation Port"! (and similar elsewhere)

I put my hand up to the accusation that I should have realised that selecting "Embarkation Port" and "Disembarkation Port" could give rise to problems - but I was trying to distinguish between "Departure Port" and "Destination Port" - which are often reported but may refer to the Ship's start and stop point! I thought I had been quite clever (always dangerous)!

But it does mean I can get sentences like, "He arrived on 3 June 1956 at Southampton from Porto on board the Edinburgh Castle (Union Castle Line Steamship Company) (ex Cape Town bound for London).

Now if I had taken "Port of Embarkation" and "Port of Disembarkation" ....
Interesting Search and Replace option?

However, I think your suggestion is worth putting on the "tweak list".
David
Running FH 6.2.7. Under Wine on Linux (Lubuntu 18.04 LTS)

User avatar
davidf
Famous
Posts: 235
Joined: 17 Jan 2009 19:14
Family Historian: V6.2

Re: GetLabelledText to be case sensitive

Post by davidf » 05 Dec 2019 14:52

tatewise wrote:
05 Dec 2019 09:31
....
=ContainsText(...) could have a similar Parameter 4 and also a Parameter 5 to match whole words.
...
Yes, I was wondering about whether there were similar gotchas with other functions.

In queries of course on the Row tab; "add/include etc if: contains/matches etc", there is a match case flag, but not a whole word flag; so "contains" "embarkation", would pick up "embarkation" and "disembarkation" (which could be useful in some cases).
David
Running FH 6.2.7. Under Wine on Linux (Lubuntu 18.04 LTS)

User avatar
tatewise
Megastar
Posts: 16884
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: GetLabelledText to be case sensitive

Post by tatewise » 05 Dec 2019 15:04

By a user preference I assume you mean Tools > Preferences setting.
Given the number of optional function parameters needed to be included for consistency, that is a lot of settings.
The function Help documentation for them could not say what the defaults are, but have to cross refer to those settings, and the settings Help would have to cross refer to the functions.
Anyway, such settings could compromise shared public custom Diagrams, Reports, Queries and Plugins that relied on those function parameter default settings.

Search and Replace would have no problem converting your labels, especially as it has case and whole word options.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
davidf
Famous
Posts: 235
Joined: 17 Jan 2009 19:14
Family Historian: V6.2

Re: GetLabelledText to be case sensitive

Post by davidf » 05 Dec 2019 15:50

tatewise wrote:
05 Dec 2019 15:04
By a user preference I assume you mean Tools > Preferences setting.
Yes, that was my original thought as possibly being simpler than extending parameters in a function - although as you point out the last can easily default to a value if not stated
tatewise wrote:
05 Dec 2019 15:04
Given the number of optional function parameters needed to be included for consistency, that is a lot of settings.
The function Help documentation for them could not say what the defaults are, but have to cross refer to those settings, and the settings Help would have to cross refer to the functions.
Yes, when you get your mind around the number of functions to which this idea could apply - it kind of "runs out of control" from a UI view point!
tatewise wrote:
05 Dec 2019 15:04
Search and Replace would have no problem converting your labels, especially as it has case and whole word options.
That looks like my immediate solution.
David
Running FH 6.2.7. Under Wine on Linux (Lubuntu 18.04 LTS)

User avatar
tatewise
Megastar
Posts: 16884
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: GetLabelledText to be case sensitive

Post by tatewise » 06 Dec 2019 14:10

Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
davidf
Famous
Posts: 235
Joined: 17 Jan 2009 19:14
Family Historian: V6.2

Re: GetLabelledText to be case sensitive

Post by davidf » 06 Dec 2019 14:52

Thanks
(can't see a simple "like" button!)
David
Running FH 6.2.7. Under Wine on Linux (Lubuntu 18.04 LTS)

User avatar
tatewise
Megastar
Posts: 16884
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: GetLabelledText to be case sensitive

Post by tatewise » 06 Dec 2019 16:37

Use the Vote option.
5 means Like a lot.
down to
1 means Like a little.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
davidf
Famous
Posts: 235
Joined: 17 Jan 2009 19:14
Family Historian: V6.2

Re: GetLabelledText to be case sensitive

Post by davidf » 06 Dec 2019 17:32

Oh I have voted
But voting is not exactly thanking you for formulating the wish list item!
David
Running FH 6.2.7. Under Wine on Linux (Lubuntu 18.04 LTS)

User avatar
tatewise
Megastar
Posts: 16884
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: GetLabelledText to be case sensitive

Post by tatewise » 06 Dec 2019 17:35

You can do that here, or in a Comment in the Wish List entry.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply