NetTalk Central

Author Topic: Trapping col sort and locate value  (Read 4168 times)

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Trapping col sort and locate value
« on: October 29, 2009, 10:17:35 PM »
Hi All,

Is there an easy way to trap the current sort column and locate value? Is it stored in a session value?

I have a Tag All button and if the user restricts the browse by sorting on dept order and locate accounts (I have a contains filter) I only want to tag those records in the filtered view.

Cheers,

Kevin

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Trapping col sort and locate value
« Reply #1 on: October 31, 2009, 11:56:32 AM »
Hi Kevin,
Watch loc:vorder and loc:vordernumber These are set in sessionvariables abd return the field name or sortorder number of the currently selected sort.
Watch for FilterWas too
Look for   ! Set Sort Order Options
Here is a sample of the code that follows -
  loc:vordernumber    = p_web.RestoreValue('UnitsList_sort',net:DontEvaluate)
  p_web.SetSessionValue('UnitsList_sort',loc:vordernumber)
  Loc:SortDirection = choose(loc:vordernumber < 0,-1,1)
  case abs(loc:vordernumber)
  of 12
    loc:vorder = Choose(Loc:SortDirection=1,'UPPER(Iso:FLD_3letter)','-UPPER(Iso:FLD_3letter)')
    Loc:LocateField = 'Iso:FLD_3letter'
  of 1
    loc:vorder = Choose(Loc:SortDirection=1,'UPPER(Uni3:UnitCode)','-UPPER(Uni3:UnitCode)')
    Loc:LocateField = 'Uni3:UnitCode'
...
 end

HTH,
chris
Real programmers use copy con newapp.exe

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Trapping col sort and locate value
« Reply #2 on: November 03, 2009, 03:35:16 AM »
Thanks again Chris.

I was able to get it to work using the following:

  If p_web.GetValue('TransferPaysBrowse_Sort') ~= ''
    p_web.SSV('L:TransferPaysBrowse_Sort',p_web.GetValue('TransferPaysBrowse_Sort'))
  End
  If p_web.GetValue('Locator2TransferPaysBrowse') ~= ''
    p_web.SSV('L:Locator2TransferPaysBrowse',p_web.GetValue('Locator2TransferPaysBrowse'))
  End

Not sure if I'm doing anything dangerous here or not but it seems to be working.

Is it safe to say the _Sort column starts at 1 for the first column and increments by 1 for each column in the browse? It seemed to be the case for the browse I was working on.

Cheers,

Kevin

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Trapping col sort and locate value
« Reply #3 on: November 03, 2009, 10:35:41 PM »
Hi Kevin,

From memory, the number is the order in which you _added_ fields to the browse, not the default order from left to right. So if you re-order columns in the list of browse fields, on the template, then no, your assumption would be incorrect.

Cheers
Bruce


kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Trapping col sort and locate value
« Reply #4 on: November 04, 2009, 04:25:42 AM »
Thanks for the clarification - is there an easy way to determine the the column number in the source or is it a matter of just debugging every browse?

Cheers,

Kev