This project has moved and is read-only. For the latest updates, please go here.

Currency Comparison?

Jun 4, 2010 at 7:07 PM

What is the proper way to compare a currency field?

x=> x["CurrencyColumn"] > (DataTypes.Currency)0

I'm looking to return items from SP that have a currency value above 0

Jun 8, 2010 at 8:29 AM

Thanks for feedback!

I just checked - indeed, it is a problem - now DataTypes.* classes don't support operators like ">", "<", ect.

The only supported operator is "==" and it works only because it is reference equality and it can be applied to reference types without operator overriding. But it doesn't have any sense in our case.

So we will add support for operators ">", ">=", "==", "<=", "<" in short period of time (today's or tomorrow's evening).

Thanks for bug report!

Jun 8, 2010 at 5:01 PM

OK thank you for looking into this. I am sure it will be a feature people use. I look forward to your implementation.


Jun 9, 2010 at 7:46 AM

Now I have added support for ">", "<", ">=", "<=" operators into some DataTypes classes where it has sense (like Currency, DataTime, etc).

var caml =
        .Where(x => x["Modified"] > (DataTypes.Currency)"1.2345")

It still string-based version, but we are also going to add implicit casting from "int", "decimal", "DateTime" types to proper DataTypes classes.

Jun 9, 2010 at 8:55 AM


now this issue is fixed. Assembly with fix has version - it is associated with Camlex 2.0 release now. You can download it from root page. Thanks

Jun 9, 2010 at 2:05 PM

Perfect, thanks for updating the library and providing a very useful feature!