How to assign a select query to LLBLGEN datasource

Posts   
 
    
kem
User
Posts: 13
Joined: 13-Oct-2009
# Posted on: 16-Oct-2009 09:39:12   

I have a LLBLGEN datasource and it selects from a table. I want my LLBLGEN datasource to have a modified select query (rather the its own one that comes default when it's properties suc as AdapterTypeName, DataContainerType, EntityFactoryTypeName are assigned). And each time i want that modified guerty to run.

Modified guery is as such;

Select Field1 + Field2 as FieldAppended, Field2, Field3 from Table

How can i do that on LLBLGEN datasource ?

Thanks...

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 16-Oct-2009 10:10:41   

LLBLGenProDataSource either fetches Entities as is or TypedList/TypedViews.

So what you can do is to try handle this in your bound control, you can have a clumn that displays the concatenation of Field1 and Field2.

kem
User
Posts: 13
Joined: 13-Oct-2009
# Posted on: 16-Oct-2009 12:49:02   

Walaa wrote:

LLBLGenProDataSource either fetches Entities as is or TypedList/TypedViews.

So what you can do is to try handle this in your bound control, you can have a clumn that displays the concatenation of Field1 and Field2.

Well it is that: I have a RadComboBox and in the DataTexttField i wantto display "ExplanationX - CodeOfExplanationX" where ExplanationX is the column that is set to DataTexField property of RadCombo and CodeOfExplanationX is third field from table and IDOfExplanationX is the column that is set to DataValueField property of RadCombo.

So there is no way to manipulate the select query of LLBLGenProDataSource ? But set a typed view to LLBLGenProDataSource's related property?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Oct-2009 20:48:01   

kem wrote:

So there is no way to manipulate the select query of LLBLGenProDataSource ? But set a typed view to LLBLGenProDataSource's related property?

Well, that is solvable in the way Walaa mentioned. You can just add a new custom property to your entity (in a partial class or in USER_CODE_REGION) that concatenate (sum or rest or whatever) your two fields. Then you set that custom property as your DataTextField and the normal CodeExplanationX field as your DataValueField. You can use LLBLGenProDataSource to write less code and let it to manage all the databinding interaction for you. So that is the easiest way to solve your concern.

kem wrote:

Well it is that: I have a RadComboBox and in the DataTexttField i wantto display "ExplanationX - CodeOfExplanationX" where ExplanationX is the column that is set to DataTexField property of RadCombo and CodeOfExplanationX is third field from table and IDOfExplanationX is the column that is set to DataValueField property of RadCombo.

Yes, you can, the way of doing that vary if you are using Adapter or SelfServicing (we don't know that yet). However it's considered as an edge customization as it is rarely needed, and it add a little complex code to maintain, and it applies to all queries from that entity, not just your combo case.

So, I recommend you first give a spin on the custom property approach first. Let us know if you need some example or something, as the forums all full of them simple_smile

David Elizondo | LLBLGen Support Team