Question About One Locator on More Than One Field

Good Day Everyone,

Clarion 11.0.0. 13505
ABC
Desktop

Question concerning browse locators.

Say I have two STRING fields in a TopSpeed table:

SomeStringOne	String(12)
SomeStringTwo	String(16)

Keys exist for both fields.

The actual data for the strings:


SomeStringOne	'015400101200'
SomeStringTwo	'01-54-00-10-1200'

The customer I’m building the app for wants a single locator that can locate on both fields. He wants to be able to type the string, with or without the dashes, to find a record.

I have never attempted such a locator.

Has anyone got some tips or advise on how to proceed?

Thank you very much!

If both fields have the same data - just cleanup his search value to be without dashes and use that key and that search filter == SomeStringTwo = searchvaluew/oDashes

-or if different values -

In this case the key does not really matter since it could be in either field. Just select a key for display purposes, just make your prop:filter
SomeStringOne = searchvalue or SomeStringTwo = searchvaluew/oDashes
Pretty much all the records need to be searched. I am sure you could do some more elaborate scheme to reduce the reads.

Look at what the SetShadow() method does.

I hit “reply” too soon. :slight_smile: SetShadow gives you an opportunity to alter the buffer that gets passed to the locator. So you can either add dashes there, or strip them out.

You don’t need both keys to accomplish it.

An alternative I’ve used in SQL is to search on a concatenation of fields. That way if it’s anywhere in those fields you get it.
Not sure that would work all that well in TPS however.

I got it sorted out!

Thank you everyone!!

Would you care to tell us how you did it so others can benefit from this discussion?

1 Like