Using function in predicate bucket

Posts   
 
    
m@rius
User
Posts: 3
Joined: 31-Jan-2007
# Posted on: 02-Feb-2007 13:27:14   

Hi, I have a TypedView and i'm tring to make predicate using a userfunction

The SQL select is like that:

select * from vw_View WHERE unitID IN (SELECT [unitID] FROM uf_userfunction(1680))

current using llbl 2.0 asp.net 2.0 c#

Wich is the syntax for add predicate for respective where clause?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Feb-2007 14:28:57   

select * from vw_View WHERE unitID IN (SELECT [unitID] FROM uf_userfunction(1680))

Would the following Query do the same job?

select * from vw_View
WHERE unitID = uf_userfunction(1680))

If so then all you have to do is to use a **FieldCompareExpressionPredicate **predicate, and pass a DBFunctionCall instance as the expression.

Please refer to the following sections in the LLBLGen Pro manual: 1- USing the generated code -> Adapter/SelfServicing -> Filtering and sorting -> The predicate system 2- Using the generated code -> Calling a database function

brene
User
Posts: 1
Joined: 02-Feb-2007
# Posted on: 02-Feb-2007 14:36:33   

The issue is the uf_userfunction return a table. And in that case we have a 'uf_userfunction is not a recognized function name.' sql error.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Feb-2007 14:50:24   

Aside from native database solutions like using another view, You can implement IExpression to generate the needed SQL, please refer to the following thread, for the know how: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3829