BACKGROUND:I have a typical MSSQL table with LastName and FirstName columns and a key on that table made up of both fields. I want to be able to use the locator filed to allow the user to enter Smith, John and have it locate to the first John Smith in the table.
APPROACH:Digging around a bit I dropped the following code in the "2 Before Browse Loop/ 11 Set Filter" embed and it does exactly what I want in terms of locating to the proper name in the table.
IF Loc:LocateField = 'PROSP:LAST_NAME'
X# = INSTRING(',',Clip(loc:LocatorValue),1,1)
IF X# > 0
ThisView{prop:Filter} = 'UPPER(PROSP:FIRST_NAME) >= <39>' & LEFT(UPPER(CLIP(SUB(loc:LocatorValue,X#+1,30)))) & '<39>'
loc:LocatorValue = Clip(SUB(loc:LocatorValue,1,X#-1))
END
END
PROBLEM:After the browse is refreshed and I am looking at the correct data if I press the Previous button it starts the browse at the first name in the table and not the names just prior to Smith. If however I press the Next button, which works as expected, and then the Previous button it all works as expected.
I am guessing it has to do with the FirstValue pointer but I cannot get a handle on it. Can anyone help with what other setting I have to play with in order to get this last piece of the puzzle working?
SOLUTION:Your terrific and simple answer goes here
Thanks
Parker