` Printed Icetips Article

Icetips Article



ABC: Locators for additional sort fields
1999-04-02 -- Jim Kane
 
Newsgroups: comp.lang.clarion

> The quaestion is that how can I assign a locator on this 'virtual
> key' - if the view sorted in that order it means that could be a locator.
> Any ideas?

Here is an example of adding a locator for an additional sort field
(acc:ar_id) that is the 2nd field in the order (one keyfield then the
additional sort field):
!data
MyLoc IncrementalLocatorClass

!Thiswindow.init after Brw1.addsortorder for the order to use the locator
for
  BRW1.AddSortOrder(BRW1::Sort0:StepClass,job:SCHEDX)
  BRW1.AddRange(job:DPT_ID,Loc:dpt_id)
  BRW1.AppendOrder('acc:ar_id')
  BRW1.SetFilter('(JOB:SCH_DATE=LOC:DATE)')
  BRW1.AddField(acc:AR_ID,BRW1.Q.acc:AR_ID)
  BRW1.ADDLOCATOR(MYLOC) !!!
  MYLOC.INIT(?LOC:ar_id,ACC:AR_ID,1,BRW1)!!!

BRW1.GetFreeElementName PROCEDURE()

ReturnValue          ANY
  CODE
  rETURNVALUE &= ACC:AR_ID !!!
  RETURN(RETURNVALUE) !!!
  ReturnValue = PARENT.GetFreeElementName()

BRW1.GetFreeElementPosition PROCEDURE()

ReturnValue          BYTE,AUTO
  CODE
  RETURN(2)  !!!additional sort field is 2nd in prop:order
  ReturnValue = PARENT.GetFreeElementPosition()

BRW1.SetSort PROCEDURE(BYTE OrderNumber)

ReturnValue          BYTE,AUTO
  CODE
  ReturnValue = PARENT.SetSort(OrderNumber)
  If ~firsttime1# and ordernumber=1
    self.sort.freeelement &=acc:ar_id
    firsttime1#=1
    put(self.sort)
  end

  RETURN ReturnValue


HTH,


---
Jim Kane



Printed November 23, 2024, 2:16 am
This article has been viewed/printed 35355 times.
Google search has resulted in 10 hits on this article since January 25, 2004.