Query class question

Mike Rowan mgrowan at fastmail.com
Mon Nov 20 22:11:26 UTC 2023


Thanks to all who replied.  Please indulge me a little more as a birthday treat.
My app is not very complex, but it has over 30 tables and some very involved PG selects. Thus although I am a novice compared to the gurus who replied, I am not a beginner.  I just have never been able to get query classes to work, and I now need them to completely normalise my table structure.
The replies to date were all helpful but did not solve the problem. Perhaps my over simplification of the example caused a problem.

Here is the actual stuff I am using as a two-table query test.
The involved schemas are set to create a table class when used for a list or row. Client 9472 exists, and has five related depot rows.

The query qdepinv must build a list relating depots to client ID 9472:
sdepot.de_id                         the schema primary key
sdepot.de_cl_id                    foreign key to client table
sclient.cl_name                        the client name 
Extra text is:
WHERE sclient.cl_id=sdepot.de_cl_id AND sclient.cl_id=9472

lSessObj is valid.
Here is the actual code I'm using as a test case.
Do *iTestList*.$definefromsqlclass('qdepinv')

Do *iTestList*.$sessionobject.$assign(*iSessObj*)

Do *iTestList*.$select('') Returns #F ## returned 0

Do *iTestList*.$fetch(kFetchAll) ## iList has correct columns but no rows


Thanks to all.


On Tue, Nov 21, 2023, at 3:54 AM, Michael Houlberg wrote:
> Mike,
> 
> If I remember correctly, you need to set the $sessionobject when using a query class and no table class.
> 
> Michael Houlberg
> Houlberg Development, LLC
> 
> Sent from my iPad
> 
> > On Nov 20, 2023, at 6:54 AM, Rudolf Bargholz <rudolf at bargholz.ch> wrote:
> > 
> > Hi Mike,
> > 
> > You could try to set the extraquerytext to " where 1 = 1 ". Perhaps a missing extraquerytext is being interpreted as an error. Have you checked the iList.$errortext and iList.$sqltext ?
> > 
> > Regards
> > 
> > Rudolf Bargholz
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> Im Auftrag von Mike Rowan
> > Gesendet: Montag, 20. November 2023 14:35
> > An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> > Betreff: Query class question
> > 
> > I am sorry to bother the list again with something that's probably simple, but I'm stuck.
> > 
> > I have a PG table of data. I have an Omnis schema and table class for it. I want to load the data into a list, so I do this:
> > Do iList.$definefromsqlclass('tauthors')
> > Do iList.$select() Returns #F
> > Do iList.$fetch(kfFetchAll)
> > 
> > That works.
> > Now I also have a query class, simplest possible. Every column from the sauthors Omnis schema only. No extra text.
> > If I change the above pseudocode slightly, to use the query, as in:
> > Do iList.$definefromsqlclass('qauthors')
> > Do iList.$select() Returns #F
> > Do iList.$fetch(kFetchAll)
> > it fails with #F = 0 though the column names are correctly shown in the list.  I don't understand why. Any hint would be welcome. As would a pointer to any more descriptive documentation than I've been able to find in the official online docs.
> > 
> > 
> > Mike Rowan
> > Mobile: 0417 812 509
> > Email: mgrowan at fastmail.com
> > _____________________________________________________________
> > Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> > _____________________________________________________________
> > Manage your list subscriptions at https://lists.omnis-dev.com
> > Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 

Mike Rowan
Mobile: 0417 812 509
Email: mgrowan at fastmail.com


More information about the omnisdev-en mailing list