How can i access to any Collection from C# code?

i can access to my Forms primary collection with: ThisForm.primarycollection...

But, how can i access to another collection from C# code.

For example.

I am on Customers Form design, i need to know how to generate XML file with a tag for a every Sales Order that have my customer, so i need to load the SLPos Collection on my code to assign the OrderNum to my XML tag.

 

Sorry for my english.

Regards!

Parents
  • There are a few different ways, so it really depends on what you're after. Tim's answer is correct but it's in VB.NET not C#. I've been using C# over VB.NET in Forms and it's made my life SOOO much easier (personal preference). But I digress....

    The C# equivalent of Tim's answer is:
    LoadCollectionResponseData response = IDOClient.LoadCollection(idoname,propertylist,filter,orderby,recordcap);

    The longer way (which I've been using [again, personal preference]) is to use a request object along with it:
    LoadCollectionRequestData request = new LoadCollectionRequestData();
    LoadCollectionResponse response;

    request.IDOName = idoname;
    request.PropertyList.SetProperties(propertylist);
    request.Filter = filter;
    request.RecordCap = recordcap;
    request.OrderBy = orderby;

    response = IDOClient.LoadCollection(request);

    I've been doing it this way because it's clearer to me each parameter set. Again; personal preference.

    If the collection you are interested in is a Secondary Collection on your Form, you would use the ThisForm.GetSecondaryIDOCollection method with an int index (which I believe) starts at 2.

    Hope this helps :)

  • Thanks.  This example is exactly what I needed.

Reply Children
No Data