Menu

using getCollectionByAttribute()

2003-12-24
2003-12-25
  • Elliot Gage

    Elliot Gage - 2003-12-24

    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

     
    • Elliot Gage

      Elliot Gage - 2003-12-24

      AToMSFramework.CPersistentCollection testColl = m_customer.getCollectionByAttribute("Country");

       
    • Richard Banks

      Richard Banks - 2003-12-25

      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.

       
    • Elliot Gage

      Elliot Gage - 2003-12-25

      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

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.