Print Page | Close Window

trim or left on char fields

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=2695
Printed Date: 13-Apr-2026 at 8:32pm


Topic: trim or left on char fields
Posted By: kpinniger
Subject: trim or left on char fields
Date Posted: 18-May-2011 at 6:20am
Any idea on when we might support EF 4 ability to do a left or trim on char columns...
 
We have values in our legacy customer databases like this for a value,
 
“AP                    ”
 
and it is a char(60).  We cannot change customers data and we cannot change customers column types, so we would like to be able to use EF 4 trim or ltrim.  So when we retrieve data we need to be able to trim off the padded spaces.
 
Thanks,
Kurt Pinniger
CDC Software
 
 



Replies:
Posted By: kimj
Date Posted: 18-May-2011 at 5:46pm
Hi Kurt,
 
Canonical functions like Trim and LTrim are supported today when using Entity SQL in DevForce.  The PassthruEsqlQuery is used for ESQL queries in DevForce.   You can find more information here - http://drc.ideablade.com/xwiki/bin/view/Documentation/passthruesql-query - http://drc.ideablade.com/xwiki/bin/view/Documentation/passthruesql-query
 
The "AfterGet" property interceptor might be a better alternative for the char fields.  With an AfterGet interceptor you can modify the value before it's returned from a property getter, so you could use this to strip off spaces.  It's true that the queried data would still have spaces when returned from the EntityServer, but since results are compressed before sending to the client the extra spaces probably don't cause a significant increase in payload size.  If you want more information on property interceptors this is a good place to start - http://drc.ideablade.com/xwiki/bin/view/Documentation/attribute-interception - http://drc.ideablade.com/xwiki/bin/view/Documentation/attribute-interception . 
 
 



Print Page | Close Window