PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: dlocke on March 17, 2023, 10:15:21 AM

Title: Assign a query to a cell at run time.
Post by: dlocke on March 17, 2023, 10:15:21 AM
Hi

Can you assign a query to a cell at run time ?
I see a "query" property in the manual but I can an error 88 trying to access it.

Don Locke.
Title: Re: Assign a query to a cell at run time.
Post by: Mike King on March 17, 2023, 10:51:37 AM
Technically the Query property doesn't exist (at least in Nomads -- in iNomads there is a property called CellQuery$ which you can alter dynamically).  What Nomads does is maintain internal tables relative to the grid column/row with the query setting.

There really isn't a way to dynamically change this table but what we would suggest is assign a query that runs a program and in that program you can decide which actual query you want to run and should your logic decide there isn't a query, display an error message.
Title: Re: Assign a query to a cell at run time.
Post by: Jane Raymond on March 20, 2023, 08:44:28 AM
One thing I have done at run time is programmatically assign a 'celltype$ (such as Lookup, LookupHideBtn, Query, QueryHideBtn) to a grid cell. Then in the cell logic you can test for _EOM$=$FF$ to determine if the query or lookup button has been pressed and then do logic to invoke the query.
Title: Re: Assign a query to a cell at run time.
Post by: dlocke on March 20, 2023, 09:17:32 AM
Thanks,
I have created the query in the presets and updated the code with work with it.

Don.