PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Sort On Header Click / Row Height  (Read 595 times)

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 188
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Sort On Header Click / Row Height
« on: June 06, 2024, 07:44:00 PM »
Hello,

I sometimes make custom queries where as the user types into a multi-line I hide rows via the RowHeight property to zero for those rows that don't meet search criteria. Customers seem to really like it, the only problem is when they ask me to enable 'SortOnHdrClick.

If i filter rows via the row height then if they click a column it just messes it up.
is there a way i can do both / hide rows and still have sort on header click enabled

jeff

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 289
    • View Profile
    • PVX Plus Technologies
Re: Sort On Header Click / Row Height
« Reply #1 on: June 07, 2024, 10:53:33 AM »
If you just want to display the records whose keys start with the value of the multiline, I have an alternate way to do this that doesn't require any coding. It involves using the smart control feature.
  • First, create a querylist with the fields you want in the report view or grid control you want to load. Add a filter where you add a Prefix based on your key (Primary Key or 'Sort By' Key), where the Prefix is an Expression that is the name of the multiline that has the value to be matched. (Side note - due to my key def I had to UCS() this value for it to work.)
  • Second, make your control 'Smart'. In the Attributes properties, click the Smart Load button, check Use Smart Load Logic and select the querylist you just created as the Panel. Under Trigger Variables and Controls, add the multiline control to Selected Triggers. Click OK and you're done.
  • Disable your current program logic on the multiline that hides your rows, as this will not be needed.
  • Test the panel. When you enter a value in your multiline, the list should reload with just the records that match and the columns will be sortable.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 188
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Sort On Header Click / Row Height
« Reply #2 on: June 07, 2024, 11:02:57 AM »
Hi Jane,

So the problem that usually brings about these queries is the Customer, Vendor Name would be something like this:
Mast Road and Grain
and they want to search for Grain

This is my conundrum. The pxplus standard queries work fine when using the keys and typing in first few letters of key.

this is more like a key word search thru the entire row of data.

maybe there is no solution for this - i have coded around it before by checking to see if they clicked on Row -1 and executing Sort Logic myself but i was trying to avoid.

jeff

Jane Raymond

  • Staff
  • Diamond Member
  • *****
  • Posts: 289
    • View Profile
    • PVX Plus Technologies
Re: Sort On Header Click / Row Height
« Reply #3 on: June 07, 2024, 02:30:57 PM »
Got it.
Take your querylist definition and change the Filter. Remove the Prefix settings and instead create a Test in the Selection Logic, something like:


Test:
YOURVAR$="" OR POS(UCS(YOURVAR$)=UCS(REC(_MWR_IOL$)))>0


This test will print the entire list if YOURVAR is blank, and if it's not it will look for the value in the data for the row which is found in REC(_MWR_IOL$).


REC(_MWR_IOL$) is somewhat esoteric, but looks like a value that would be useful for tests like this, so I'll create a new query variable containing its value for the next release.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.

Jeffrey Ferreira

  • Diamond Member
  • *****
  • Posts: 188
  • I must have taken a wrong turn at Albuquerque.
    • View Profile
Re: Sort On Header Click / Row Height
« Reply #4 on: June 07, 2024, 02:34:25 PM »
I will give that a try Jane. Thank you.