using Substring in predicate creations

Posts   
 
    
stoneyowl avatar
stoneyowl
User
Posts: 62
Joined: 29-Jan-2004
# Posted on: 25-Apr-2005 19:35:52   

Using 1.0.2004.1 assemblys....

I need to create an 'IN' predicate using the FieldCOmpareRangePredicate() where the target of the elements of the IN list are a substring of the contents of the DB field, ie:


select * from trans_requests where substring(transcript_id,1,2) in ('TH','CN','BR') and date_received between '20050401' and '20050425'
order by transcript_year,transcript_id;

where the 'IN' list is the variable.

I do not see where this can be done. Is it possible?

jtgooding
User
Posts: 126
Joined: 26-Apr-2004
# Posted on: 25-Apr-2005 19:50:00   

The IN is done with the SET predicate, which is easy enough your bigger issue will be that there isn't a substring predicate unless it was just released in the last version, but I thought the system functions were coming in the June/July release.

John

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 26-Apr-2005 11:52:37   

Indeed, functions aren't supported yet.

You can modify the FieldCompareRangePredicate sourcecode to create a different FieldCompareRangePredicate class in which you then emit a substring function around the field name.

Frans Bouma | Lead developer LLBLGen Pro