Menu

To order attribute in the Atomsframework 2.1

2005-05-02
2013-03-07
  • Nobody/Anonymous

    Hi,

    In the my application, i declare a variable of the type collection for to add the attribute of the ordenation of the my DataGrig in the following form:

    Dim attribute As New Collection()
    attribute.Add("description")

    However, the metod getAll of the class CPersistenceObject implements the following code:

    If pOrderAscCol.Item(pOrderCol.Item(inIndex)) Is Nothing Then
                            boAscend = False
                        End If

    So, the variable inIndex is the index of the collection "attribute" and the code up, in run time, execute of the following form:

           If pOrderAscCol.Item("description") Is Nothing Then

    because pOrderCol.Item(inIndex) is equal the "description". However, the property item no accept parameter of the type string and, in the case, results in error of the parameter invalid.

    How to resolver this problem?

    Thanks,
    Meiriana.

     
    • Richard Banks

      Richard Banks - 2005-05-02

      The GetAll(Collection, Collection) method is meant to have two collections passed to it.

      One is a collection with the attribute names to order by.

      The second collection is the attribute names to sort in ascending order.

      Both collections should contain strings.

      Can you post the code you are using to call the GetAll method?  Also is the exception an argument exception, or an index out of range exception?

      I noticed that there is no try/catch block around the code.

      P.S. The Collection.Item property can be passed either an integer or an object.

      - Richard

       
    • Nobody/Anonymous

      Hi,

      Code used to call the GetAll method:

      Dim attribute As New Collection()
      attribute.Add("description")
      object.getAll(attribute, attribute)

      PS. object represents a intance of the a class.

      The exception:
      System.ArgumentException: Argument 'Index' is not a valid value.

      Thanks.

       
      • Richard Banks

        Richard Banks - 2005-05-09

        The code was meant to work something like this:

        Dim attribute As New Collection() 
        Dim sortAttribute as New Collection()
        attribute.Add("description") 
        sortAttribute.add(true,"description")
        object.getAll(attribute, sortAttribute)

        But I've looked at it and it's a bit of an ugly way to do it.

        I've changed the GetAll method to work either way now, so your existing code should work fine.

        Get the latest code from CVS (which is the 2.2 version).

        P.S. Sorry for the delayed response.

         
    • Nobody/Anonymous

      Hi,

      Thank you of the support!!!

       

Log in to post a comment.