Query class question
TBS
andyh at totallybrilliant.com
Mon Nov 20 22:53:24 UTC 2023
Mike
In pure Postgres this would be something like :
SELECT sdepot.de_id, sdepot.de_cl_id, sclient.cl_name FROM sdepot, sclient WHERE sclient.cl_id=sdepot.de_cl_id AND sclient.cl_id=9472
Does this work as it shows in pg admin ?
That’s the place to start……then work back to Omnis from there - further to my earlier email, you likely then need the ‘FROM’ clause spelling out as well :)
Andy Hilton
Totally Brilliant Software Inc
Phone (US) : (863) 409 4870
Phone (UK) : 0207 193 8582
Web : www.totallybrilliant.com
Helpdesk : https://totallybrilliantsoftware.supportsystem.com/
Email : andyh at totallybrilliant.com
On Nov 20, 2023, 5:12 PM -0500, Mike Rowan <mgrowan at fastmail.com>, wrote:
> 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
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list