Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> How to limit cols returned in GetMulti?
 

Pages: 1
LLBLGen Pro Runtime Framework
How to limit cols returned in GetMulti?
Page:1/1 

  Print all messages in this thread  
Poster Message
Jared
User



Location:

Joined on:
15-Aug-2007 23:11:05
Posted:
8 posts
# Posted on: 12-Sep-2007 17:25:01.  
This is probably a simple question, but I'm fetching a ton of rows from one of my tables, and for memory reasons, I only want to get the columns I need.

Could anyone point me in the right direction?

Thanks,
- Jared
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14626 posts
# Posted on: 12-Sep-2007 18:02:09.  
You have the following options:

1- Starting from v.2.5 the concept of execluding fields from the fetch was introduced.
(ref: manual "Using the generated code -> SelfServicing/Adapter -> Excluding / Including fields for fetches")

2- You can use the designer to map another entity onto the same table but this time with fewer fields.

3- You can use a TypedList or a DynamicList, to fetch the needed fields.
Also you can project the results back to an entityCollection (Projection).


  Top
Jared
User



Location:

Joined on:
15-Aug-2007 23:11:05
Posted:
8 posts
# Posted on: 12-Sep-2007 19:43:22.  
Awesome, got it working with a dynamiclist. What's this about projecting it back on to an entity collection?
  Top
Jared
User



Location:

Joined on:
15-Aug-2007 23:11:05
Posted:
8 posts
# Posted on: 12-Sep-2007 20:14:55.  
Nevermind, I looked that up myself. I have another quick question though, if anyone knows off hand. Now that I have this DataTable, I'm just doing a for loop through it to get what I need, but it'd be better if I could tell one of the columns to be a primary key and then do table.Rows.Find(). Anyone know if this is possible?

- Jared


  Top
Jared
User



Location:

Joined on:
15-Aug-2007 23:11:05
Posted:
8 posts
# Posted on: 12-Sep-2007 20:46:41.  
Ok, I added a PredicateExpression and now I'm getting some error, which I don't believe has a good reason for happening. On the last line of the following code, I'm getting the error "The multi-part identifier \"dev.dbo.feed_venue.data_load_id\" could not be bound."

Any ideas?

Code:

ResultsetFields fields = new ResultsetFields(3);
fields.DefineField(FeedVenueFields.DataSourceItemId, 0, "DataSourceItemId", "FeedVenue");
fields.DefineField(FeedVenueFields.FeedVenueId, 1, "FeedVenueId", "FeedVenue");
fields.DefineField(FeedVenueFields.DataLoadId, 2, "DataLoadId", "FeedVenue");
                
PredicateExpression GetAllForThisDataLoad = new PredicateExpression();
GetAllForThisDataLoad.Add(FeedVenueFields.DataLoadId == dataLoadId);
                
TypedListDAO dao = new TypedListDAO();
dao.GetMultiAsDataTable(fields, dynListAllFeedVenues, 0, null, GetAllForThisDataLoad, null, true, null, null, 0, 0);
  Top
JimHugh
User



Location:
Davis, CA
Joined on:
16-Nov-2005 14:32:25
Posted:
191 posts
# Posted on: 12-Sep-2007 21:22:42.  
It looks like you may be having problems with _ chars.

Try taking out the table alias definitions as show below.
Code:

fields.DefineField(FeedVenueFields.DataSourceItemId, 0, "DataSourceItemId");
fields.DefineField(FeedVenueFields.FeedVenueId, 1, "FeedVenueId");
fields.DefineField(FeedVenueFields.DataLoadId, 2, "DataLoadId");


Jim Hughes  Top
Jared
User



Location:

Joined on:
15-Aug-2007 23:11:05
Posted:
8 posts
# Posted on: 12-Sep-2007 22:06:27.  
Nice, that worked! Thanks!

- Jared
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.