You need to watch the names of the function calls. The getCollectionByAttribute gets the CPersistentCollection object held by the attribute (in your case Country).
However Country is not a CPersistentCollection but rather a CPersistentObject and so you are getting a type mismatch.
You probably want to use getCollectionByAttributeWithEqualsTo("Country"). You will also want to make sure that the Country attribute is populated before you make the call, as you will get back all customer objects with a matching country.
Hope that helps.
Richard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks, I have had some time to walk through the library. The get..Attribute... methods are for cardinals of the CPersistentObject I am using. What I was looking for was a way to retrieve objects without using the Find and Retrieve methods.
Looks like what I need to use are the criteria and CCursor classes.
Merry Christmas,
Elliot
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am unable to retrieve objects using the getCollectionByAttribute() function.
I am getting a type mismatch error (generated from the VB:CallByName() when I specify the attribute name Using the Customer form demo:
AToMSFramework.CPersistentCollection = m_customer.getCollectionByAttribute("County");
Does anyone have examples of retrieving objects other than using the Find and Retrieve method?
Thanks,
Elliot
AToMSFramework.CPersistentCollection testColl = m_customer.getCollectionByAttribute("Country");
You need to watch the names of the function calls. The getCollectionByAttribute gets the CPersistentCollection object held by the attribute (in your case Country).
However Country is not a CPersistentCollection but rather a CPersistentObject and so you are getting a type mismatch.
You probably want to use getCollectionByAttributeWithEqualsTo("Country"). You will also want to make sure that the Country attribute is populated before you make the call, as you will get back all customer objects with a matching country.
Hope that helps.
Richard.
Richard,
Thanks, I have had some time to walk through the library. The get..Attribute... methods are for cardinals of the CPersistentObject I am using. What I was looking for was a way to retrieve objects without using the Find and Retrieve methods.
Looks like what I need to use are the criteria and CCursor classes.
Merry Christmas,
Elliot