Sort On Header Click / Row Height

Started by Jeffrey Ferreira, June 06, 2024, 07:44:00 PM

Previous topic - Next topic

Jeffrey Ferreira

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

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

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

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

I will give that a try Jane. Thank you.

Jane Raymond

Further on using REC(_MWR_IOL$), the result could contain some color mnemonics and/or additional fields, so for the next release I've added a special QUERY_ROW$ variable that contains just the current contents of a row with the mnemonics stripped. It can be used in selection criteria or as a return value.
Jane Raymond
Software Developer
PVX Plus Technologies Ltd.