Calculating values to fetch top 20

Posts   
 
    
bvalle
User
Posts: 54
Joined: 07-Jun-2006
# Posted on: 09-Apr-2007 15:41:25   

Hello

LLBLGen Pro 2.0 - Adapter

Given variables XLoc, YLoc, ZLoc, DD, ClientID, ZoneID, and RefMeterMeshDeviceID. And fields from A table X, Y, Z, ClientID, ZoneID.

I want to perform the LLBLGen equivalent of:

SELECT TOP 20 * FROM tblDeviceData as A WHERE (((A.X-XLoc)(A.X-X.Loc) + (A.Y-YLoc)(A.Y-YLoc) + (A.Z-ZLoc)(A.Z-ZLoc)) <= DD)* AND A.ClientID = ClientID AND A.ZoneID = ZoneID

Specifically, I am interested in how to represent the where clause phrase highlighted in bold.

Could you please point me in the right direction?

Thank you, BV

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39926
Joined: 17-Aug-2003
# Posted on: 09-Apr-2007 16:40:03   

Thats an 'expression' so you should use an Expression in the where, and from the looks of it, it looks like you'd need a FieldCompareExpressionPredicate, whree you compare DD with the expression in bold and the >= operator.

See for more info about expressions the section 'Field expressions and aggregates' for examples and more info.

Frans Bouma | Lead developer LLBLGen Pro