Print Page | Close Window

Need to load a substring over devforce

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3341
Printed Date: 13-May-2026 at 8:27am


Topic: Need to load a substring over devforce
Posted By: anishedhli
Subject: Need to load a substring over devforce
Date Posted: 16-Mar-2012 at 4:05am
Hello everybody

my problem is the following:
I have a field in a database table (the field is named "content"). During the loading of the table records, I don't want to extract the entire field value , but the x first characters.

Example:

Content = "Hello world , how are you ??"
what should be extracted = "Hello world"

I ask if there is a manner to make it directly in DevForce (cause of the huge amount of information to transport over the network).

Thanks a lot in advance



Replies:
Posted By: smi-mark
Date Posted: 16-Mar-2012 at 1:19pm
You can use a projection to do what you want.

http://drc.ideablade.com/xwiki/bin/view/Documentation/query-anonymous-projections




Posted By: midnit
Date Posted: 19-Mar-2012 at 2:41pm
If the projection is not as easy to work with as you would like we did it another way.
 
Basically we defined the query for the entity in the model (rather than using table def) and the particular column was truncated in the query itself, then we created another entity with the records id and the full value and joined the two entities 1 to 1. Though these technically point to the same table in the database each entity had its particular data and we only retrieved the full data at one record at a time as necessary. It also allowed us to edit it easy enough.
 
I am not claiming this is a great solution but it worked in our situation.
 
In another more data intense scenario we ended up moving the lob to its own table but the model basically remained the same.


Posted By: anishedhli
Date Posted: 21-Mar-2012 at 5:48am
Thanks a lot smi-mark and midnit (so kind from yourselves).
I solved it by making LINQ queries with anonymous types. the link that msi-mark suggested was very interesting and useful in my case :)
 



Print Page | Close Window