Expression Clauses in a query

Hello

We are trying to use a join clause in a script on 1IM. The problem we have is that when we are using classes .Join and .On of the object Query, .On class only admit ExpressionClause Type. Is there any example of how to declare and initialize this type?

Thanks in advance,

Adri 

Parents
  • There is no sample as far as I know. But if you try to join over a foreign key column you do not need an ExpressionClause.

    The following sample loads a collection of business roles where the org type (Org.UID_OrgType.Ident_OrgType) is "Business Roles".

    Dim f As ISqlFormatter = Session.SqlFormatter()
    Dim strOrgType As String = String.Empty
    
    strOrgType = "Business roles"
    
    Dim qOrgQuery As Query
    qOrgQuery = Query.From(Table.Org).Join(Table.OrgType, "ot").On(Table.Org.UID_OrgType).Select(Table.OrgType.Ident_OrgType).Where( _
        f.Comparison(String.Format("ot.{0}", Table.OrgType.Ident_OrgType), strOrgType, ValType.String, CompareOperator.Equal))
    
    Dim mycollection As TypedEntityCollection(Of VI.DB.Model.Org) = Session.Source.GetCollection(Of VI.DB.Model.Org)(qOrgQuery, EntityCollectionLoadType.Bulk)
    
    
    Return mycollection.Count.ToString
    

    Please be aware that the join is just usable to identify the data to load. A collection always loads entities of one specific type. You cannot join additional columns to it.

  • ive tried it, and i am getting 'Join' is not a member of 'IJoin'. Error 

    Dim qADSAccountInADSGroup = Query.From(Table.ADSAccountInADSGroup, "aia") _
    					.Join(Table.ADSAccount, "a") _
    					.On(Table.ADSAccountInADSGroup.UID_ADSAccount) _
    					.Join(Table.Person, "p") _
    					.On(Table.ADSAccount.UID_Person) _
    					.Select(Table.ADSAccountInADSGroup.XObjectKey) _
    					.Where(String.Format("aia.{0}", Table.ADSAccountInADSGroup.XMarkedForDeletion), "2", ValType.String, CompareOperator.Equal)

  • ah i see, i cant join more than one time.. such pitty

    back to CDATA SQL... haha

Reply Children
No Data