$select and $fetch
Brian A O'Sullivan
brian.a.o-sullivan at axalta.com
Wed Feb 8 12:21:02 UTC 2023
Hi Daniel,
I agree it's rather confusing to have to enter so many quote characters directly in the parameters for the $select method. I often use the Text Block commands to prepare the where & order-by clause for my $selects:
Begin Text block
Text: WHERE user_id = [iUserList.user_id]
End text block
Get text block whereTxt
Do myRow.$select(whereTxt)
Another reason I like this approach is that you can incorporate conditional statements to make the where clause respond dynamically to the current situation:
Begin text block
Text: WHERE
If conditionA=kTrue
Text: field1 = [var1]
Else
Text: field2 = [var2]
End if
Text: order by...
Best regards,
Brian A. O'Sullivan
Delaware, USA
Sensitivity: Business Internal
-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of Daniel Sananes
Sent: Tuesday, February 7, 2023 9:15 PM
To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Subject: [EXTERNAL]Sv: $select and $fetch
Hi Mike
You made my night!
Sitting in dark Sweden getting more and more disappointed.
Starting to wonder if $fetch always returns the first record.
Then your solution.
Brilliant.
A bit confusing with all ' and ". I probably had them wrong in all my testing.
There ought to be another way so one easily could change the table/schema names in one place and it gets reflected in the statements.
Many thanks
Daniel
-----Ursprungligt meddelande-----
Från: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> För Mike Rowan
Skickat: den 8 februari 2023 01:42
Till: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Ämne: Re: $select and $fetch
Hi Daniel
I add a query condition within the parentheses after $select like this
Calculate lvQuery as con("WHERE user_id='",iUserList.user_id,"'") Do iRow.$select(lvQuery) Do iRow.$fetch(kfetchall) Returns iFetchStatus
Might be a bit old fashioned, but so am I.
Cheers. Mike
On Wed, Feb 8, 2023 at 5:45 AM Daniel Sananes <daniel.s at kopparbergs.se>
wrote:
> Hi everybody
>
> Having proceeded with Studio I have now got stuck with select and fetch.
> I have a window that reads all users from the Sqlite database.
> This works nice and all users are presented in a list.
> Do iUserList.$definefromsqlclass('user') Returns #F.
> Do
> iUserList.$sessionobject.$assign($root.$sessions.[iSession].$sessionob
> ject)
> Returns #F.
> Do iUserList.$select() Returns #F.
> Do iUserList.$fetch(kFetchAll) Returns lFetchStatus.
>
> When clicking on list iUserList the user_ID is retrieved.
> Then I do as below to get user into a row. I always get the first
> user, that is the user with id 1.
>
> How do I construct the $select so it selects record with the test-ID 68?
> Or maybe the $fetch is wrong?
>
> Calculate lID as 68.
> Do iRow.$definefromsqlclass('user') Returns #F.
> Do
> iRow.$sessionobject.$assign($root.$sessions.[iSession].$sessionobject)
> Returns #F.
> Do iRow.$select([iUserList.user_id=lID]) Returns #F.
> Do iRow.$fetch() Returns iFetchStatus.
>
>
> regards
> /Daniel
> 0736 704070
>
> _____________________________________________________________
> Manage your list subscriptions at
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.omnis-dev.com%2F&data=05%7C01%7C%7C8ebefacc6ede42005d8908db097a4c85%
> 7C8b4a07aecf3941d38e235c8d4c152da5%7C0%7C0%7C638114193256318358%7CUnkn
> own%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
> LCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Fhz7HSDbR59u2cOqf5LljKRNdQ0pWejys
> SH6xQLFCc8%3D&reserved=0 Start a new message ->
> mailto:omnisdev-en at lists.omnis-dev.com
>
_____________________________________________________________
Manage your list subscriptions at https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.omnis-dev.com%2F&data=05%7C01%7C%7C8ebefacc6ede42005d8908db097a4c85%7C8b4a07aecf3941d38e235c8d4c152da5%7C0%7C0%7C638114193256318358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Fhz7HSDbR59u2cOqf5LljKRNdQ0pWejysSH6xQLFCc8%3D&reserved=0 Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
VARNING: Det här e-postmeddelandet kommer från en extern avsändare. KLICKA INTE på länkar eller bilagor om du inte känner igen avsändaren och vet att innehållet är säkert.
_____________________________________________________________
Manage your list subscriptions at https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.omnis-dev.com%2F&data=05%7C01%7C%7C8ebefacc6ede42005d8908db097a4c85%7C8b4a07aecf3941d38e235c8d4c152da5%7C0%7C0%7C638114193256318358%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Fhz7HSDbR59u2cOqf5LljKRNdQ0pWejysSH6xQLFCc8%3D&reserved=0
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
This communication is for use by the intended recipient and contains information that may be Privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. For more information regarding how we collect and use your personal data, and any related rights you may have, please review our Privacy Statement. <https://www.axalta.com/corporate/en_US/privacy/global-privacy-statements.html>
More information about the omnisdev-en
mailing list