Convert IEntityCollection to String Array

Dear community,

is there an easier / shorter way to convert values from IEntityCollection to a string array? At the moment I'm filling in the string array by looping through the IEntity object like this:

...

    Dim colObjects As IEntityCollection = Session.Source.GetCollection(Query.From("PersonWantsOrg").Select("XObjectKey").Where(WhereClause))

        If colObjects.Count > 0 Then

            Dim arrXObjKey As String() = New String(colObjects.Count - 1) {}

            For Each colElement As IEntity In colObjects

                arrXObjKey(counterAttCase) = colElement.GetValue("XObjectKey").ToString

                counterAttCase += 1

            Next
...

Thanks in advance!

Kind regards,

Rinay

Parents
  • Hi Markus,

    I'm using the string-array to create attestation cases using the method CreateAttestations:

    ...
    
        Dim colObjects As IEntityCollection = Session.Source.GetCollection(Query.From("PersonWantsOrg").Select("XObjectKey").Where(WhereClause))
    
            If colObjects.Count > 0 Then
    
                Dim arrXObjKey As String() = New String(colObjects.Count - 1) {}
    
                For Each colElement As IEntity In colObjects
    
                    arrXObjKey(counterAttCase) = colElement.GetValue("XObjectKey").ToString
    
                    counterAttCase += 1
    
                Next
                
                Dim policy As IEntity = Session.Source.Get("AttestationPolicy", uidAttestPolicy)
    
                policy.CallMethod("CreateAttestations", arrXObjKey)
                policy.Save(Session)
    
    ...

Reply
  • Hi Markus,

    I'm using the string-array to create attestation cases using the method CreateAttestations:

    ...
    
        Dim colObjects As IEntityCollection = Session.Source.GetCollection(Query.From("PersonWantsOrg").Select("XObjectKey").Where(WhereClause))
    
            If colObjects.Count > 0 Then
    
                Dim arrXObjKey As String() = New String(colObjects.Count - 1) {}
    
                For Each colElement As IEntity In colObjects
    
                    arrXObjKey(counterAttCase) = colElement.GetValue("XObjectKey").ToString
    
                    counterAttCase += 1
    
                Next
                
                Dim policy As IEntity = Session.Source.Get("AttestationPolicy", uidAttestPolicy)
    
                policy.CallMethod("CreateAttestations", arrXObjKey)
                policy.Save(Session)
    
    ...

Children
No Data