AW: $select in table

Rudolf Bargholz rudolf at bargholz.ch
Sun Mar 19 07:23:53 UTC 2023


Hi Daniel,

where client_name like '@%Amaz%'

Here you are asking the server to return a text that begins with "@", and then has a text part with the structure "Amaz" following the "@"

You SQL ought to look as follows:

where client_name like '%Amaz%'

or

Calculate clientname as low('Amaz')
Calculate clientname as con('%', clientname,'%')

Sta: select * from ORDER where lower(client_name) like @[clientname]

The '@' is not a part of the string but denotes a bind variable in the SQL.

Regards

Rudolf

-----Ursprüngliche Nachricht-----
Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> Im Auftrag von Daniel Sananes
Gesendet: Samstag, 18. März 2023 23:15
An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Betreff: Sv: $select in table

Thanks Scotte

This works: where client_name like '%Amaz%'.
But the @ is confusing and does not work: where client_name like '@%Amaz%'.

Daniel

-----Ursprungligt meddelande-----
Från: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> För Scotte Meredith
Skickat: den 18 mars 2023 20:18
Till: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Ämne: Re: $select in table

Always start with how the full SQL would look.
In your case:
SELECT * FROM client WHERE client_name LIKE '%somethinghere%'
The $select is the WHERE clause
So put this first:
Calculate clientname = con('%',clientname,'%')
Then:
   where client_name like @[clientname]

Using the @ sign makes it a bind variable so the SQL DAM will put in the quotes or whatever is needed for the particular SQL field type. Also can make it more efficient and other things, but that's another story.
Also remember that the $select just sets the data set to use. Then you need to $fetch to get 1 at a time, or all at once or 100 at once or whatever you decide.

Scotte Meredith
spomacguy at gmail.com
509/998-0991

> On Mar 18, 2023, at 11:52 AM, Daniel Sananes <daniel.s at kopparbergs.se> wrote:
>
> Hi all
> I am having problems understanding the $select.
> As I am using tables now I would like to override the table $select.
> I am constructing an order-window now and want to let user enter a part of a clients name to find the client.
> Begin text block
> Text: where client_name LIKE [clientname] End text block Get text 
> block lQuery Do iclientrow.$select(lquery)
>
> The only thing that works is if I explicitly send "where client_id=1".
>
> Are there a kind soul out there who could give me an example how an overridden $select would look?
> As I don't know how the inbuilt $select looks I feel lost somehow.
>
> I guess there are joins and other useful stuff you could have in a 
> $select-method
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com 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://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


More information about the omnisdev-en mailing list