This project has moved. For the latest updates, please go here.

Currency Comparison?

Jun 4, 2010 at 6: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 7: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 4: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 6: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 7: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 1:05 PM

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