` Printed Icetips Article

Icetips Article



ABC: Locators on browses with header sort enabled
2006-03-03 -- Michael Ware
 
>I have been playing around with using the Sort Headers option on a browse
> and was surprised that the locator worked for whichever Header order was
> selected - however...
>
> Browse has 3 sort orders - Customer ID (Short) - Invoice ID (Long) and
> Date
> - I had specifed that INV:NO was used in the locator, which works fine for
> the Customer ID but not for the Date field which needs to be entered in a
> @D5 format - I was surprised that the locator seemed to 'know' which sort
> order was selected but I don't know how to have the one locator field work
> for all the sort orders.


You can check which sort is being triggered in the Browse Class' embed:
SetOrder PROCEDURE(STRING Order)

I used the following to change a prompt when a header sort was changed:  In
the SetOrder Data Embed I declared:

FirstOrder  String(150)

Then in the SetOrder Code embed before parent call I had something like:

    FirstOrder = Order
    Case FirstOrder[1]
    Of '-' OROF '+'
      FirstOrder = SUB(FirstOrder,2,LEN(CLIP(FirstOrder)))
    End
    If Instring(',',CLIP(FirstOrder),1,1)>0
      FirstOrder = SUB(FirstOrder,1,INSTRING(',',FirstOrder,1,1)-1)
    End
    Case FirstOrder
    Of 'TBL:CustID'
      ?Tab1Locator_Prmpt{Prop:Text} = 'Cust #:'
      ?SearchVar{Prop:Text} = '@N7'
    Of 'TBL:Invoice'
      ?Tab1Locator_Prmpt{Prop:Text} = 'Invoice #:'
      ?SearchVar{Prop:Text} = '@N7'
    Of 'TBL:INVDate')
      ?Tab1Locator_Prmpt{Prop:Text} = 'Date:'
      ?SearchVar{Prop:Text} = '@D5'
    Else
      ?Tab1Locator_Prmpt{Prop:Text} = 'Search:'
      ?SearchVar{Prop:Text} = '@S20'
    End



Printed November 21, 2024, 7:30 am
This article has been viewed/printed 35397 times.
Google search has resulted in 2 hits on this article since January 25, 2004.