How to render Max(Substgring) with Lambda Extensions
- by caifa
Hi everybody. I'm using NHibernate with Lambda Extensions. I'd like to know how to nest a Max function with a Substring.
The following statement retrieves Max("invoice_id")
var ret = session
.CreateCriteria<Invoice>()
.SetProjection(Projections.Max("invoice_id"))
.UniqueResult();
but in my case the field invoice_id is made in this way: 123452010 where 12345 is the invoice number, and 2010 is the current year. So I need to calculate the Max function only over the first 5 digits. How can I do it?