Welcome to Habanero Land!   Register  |  Login
You are here:   Blogs
  So, why do you need to register to download Habanero and access the additional materials? 
The success of any open source project is based on the community built around it. So go ahead, register / login and get involved!
Blog Roll
 
Categories
 
Search Blog
 
 
Habanero Cloud
 
Habanero Archive
 
Recent Blog Posts
 
 
Mar 31

Written by: Peter Wiles
Wednesday, March 31, 2010 5:34 PM  RssIcon

So the new Habanero version (2.3.2) is out, and one of the new features is an improvement in loading collections in the form of an IN operator (and its negative, not in).  This works similarly to how it's used in SQL - in fact it gets translated into a SQL in clause if your Habanero app is running against a database.  Here's an example of using it in loading a set of Person objects:

BusinessObjectCollection persons =
    Broker.GetBusinessObjectCollection(
        "Surname in ('Wiles', 'Powell', 'Naidu')");

It's a really intuitive syntax because of its close relation to SQL's in statement.  Also available is the 'not in' operator which does exactly what it says - searches for items not in the given list.

If you want to load using the more type-safe Criteria objects, or you are using code to build up your criteria clause, you can do it like this:

object[] values = new object[] 
    {"Wiles", "Powell", "Naidu"};
Criteria.CriteriaValues criteriaValues = 
    new Criteria.CriteriaValues(values);
Criteria criteria = new Criteria(
    "Surname", Criteria.ComparisonOp.In, criteriaValues);
BusinessObjectCollection persons = 
    Broker.GetBusinessObjectCollection(criteria);

I should also add that the loading of collections has been heavily profiled in this release and it's much much faster than it used to be.
 

5 comment(s) so far...


Gravatar

Re: Habanero 2.3.2: new feature - "in" operator

Good job! We have awarded Habanero with a highest award!

By iDownload on   Thursday, April 08, 2010 10:46 PM
Gravatar

Re: Habanero 2.3.2: new feature - "in" operator

Great, I have been waiting for this feature.
Will try implementing this DLL on a n existing 2.3.1 project, once I have some time.

Thanks
Musa

By Musa on   Wednesday, May 05, 2010 11:14 AM
Gravatar

Re: Habanero 2.3.2: new feature - "in" operator

Musa, upgrading from 2.3.1 to 2.3.2 is really straightforward - there is only one breaking change that I know of - the change in the code needed to load your classdefs and there's a thread on the forum about how to correct that. Let me know how it goes

Peter

By Peter Wiles on   Thursday, May 13, 2010 1:00 PM
Gravatar

Re: Habanero 2.3.2: new feature - "in" operator

Another excellent new feature.
I have wanted to create a grid filter where the user could select to filter for items that have a status e.g. Accepted, In Progress etc I landed up doing loads of Or this is definitely more elegant.

By brettright on   Friday, May 14, 2010 9:27 AM
Gravatar

Re: Habanero 2.3.2: new feature - "in" operator

I have spent time trying to figure out a way of filtering my collection, using such logical operators as 'IS NOT' which of cause did not work, unitl I came across this post; the 'in' operator. I was able to filter my collection using 'not in'.

Fantastic feature, this is one operator I had forgetten about.

Thanks Pete!

By Donald on   Friday, May 14, 2010 11:27 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 

This website is best viewed in Internet Explorer 7 & 8; Firefox; Opera; & Safari.

Get Habanero at SourceForge.net. Fast, secure and Free Open Source software downloads