ADS SQL statement to check in array

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

ADS SQL statement to check in array

Post by ic2 »

In ADS I can select

cQuery:="Select * from Mydbf d where d.somedate>='"+Date2SQLDate(dFrom)+"' AND d.somedate<='"+Date2SQLDate(dTo)+"' "
cQuery+="AND d.relation='"+cRel+"' "

in which case I get records within the given date range for this (1) relation (e.g. client) only.
I however do have a selection of relation keys in an array aRelations. But this won't work as 2nd line:

cQuery+="AND ascan(SELF:aRelations,d.relations)<>0"
Is there a way to achieve that?

Dick
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

ADS SQL statement to check in array

Post by wriedmann »

Hi Dick,
I would transform the content of self:aRelations to a SQL array and write:
cQuery += " and d.relations in ( x, y, z, ... )"
For such uses I have a function Array2SQLList().
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ic2
Posts: 1798
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

ADS SQL statement to check in array

Post by ic2 »

Hello Wolfgang,

Yes, that work, thanks a lot! I wasn't aware of SQL arrays until your reply.

Dick
Post Reply