` Printed Icetips Article

Icetips Article



Par2: Substitute locator
2002-02-10 -- Chet Sapino
 
> I have a data field in a file that is a string 4 bytes long. However, it
is
> not string data. It is binary data. We normally input it as a string than
> run it through a routine that converts it to binary. When we want to
display
> it we deconvert it from binary to string. So far it is simple.
>
> Now someone want a locator on that field. It is a valid request since the
> field contains an identifier. So I decided to create a dummy string,
convert
> it to binary and stuff it into the locator string, and then do a
> POST(EVENT:Accepted, ?LOC:Goto).
>
> It ---did not--- work. I know that I am triggering the
> BRW1::Sort2:Locator.TakeEvent() and BRW1::Sort2:Locator.Reset(). However,
> the browse still does not locate.

1. Populate the file field on the tab with the locator and hide it. The
locator must be Entry type.
2. Populate a variable on the tab to hold the string for the location.
3. Put a "Find" button on the tab and in the embed, run the variable thru
your routine to convert it to the binary var, and then do an
Access:file.Fetch(byBinaryKey) to get the record by the binary var.
4. Do a BRW1.ResetFromBuffer and it will take the browse to the located
record.

If you don't want to use a "Find" button, you can put the code in the entry
field and execute it with the Tab Key in the Accept .

This also works with multiple fields in a multicomponent key as a locator in
both a Windows app or a Java Free HTML browse. All of the entry fields must
be populated and hidden. Variables for each locator field must be populated.
Enter data in any one of the fields, press the "Find" button which assign
the vars to the key, get the record and reset the browse.



Printed November 23, 2024, 2:20 am
This article has been viewed/printed 35212 times.