LoadCollection

A LoadCollection request/response document uses the LoadCollection method of an IDO to query either an IDO collection or a database table and return the results to the user.

Request data

A LoadCollection request document has this payload structure and contains data such as the collection name, property list, and so on, which are required to complete the request.

<RequestData>
  <LoadCollection Name="collection" LoadCap="loadcap">
    <LoadType>loadtype</LoadType>
    <ReadMode>readmode</ReadMode>
    <Cursor />
    <PropertyList>
      <propertyname>property01</propertyname>
      <propertyname>property02</propertyname>
      <propertyname>property...</propertyname>
    </PropertyList>
    <RecordCap>recordcap</RecordCap>
    <Filter>filter</Filter>
    <OrderBy>orderby</OrderBy>
    <PostQueryCmd>command</PostQueryCmd>
  </LoadCollection>
</RequestData>

Resonse data

A LoadCollection response document has this payload structure and includes requested data and return values.

<ResponseData>
  <LoadCollection Name="collection" LoadCap="loadcap">
    <PropertyList>
      <propertyname>property01</propertyname>
      <propertyname>property02</propertyname>
      <propertyname>property...</propertyname>
    </PropertyList>
    <LoadType>loadtype</LoadType>
    <RecordCap>recordcap</RecordCap>
    <Filter />
    <OrderBy />
    <PostQueryCmd />
    <Items>
      <Item ID="itemid01">
        <P>propertyvalue</P>
        <P>propertyvalue</P>
        <P>propertyvalue</P>
      </Item>
      <Item ID="itemid02">
        <P>propertyvalue</P>
        <P>propertyvalue</P>
        <P>propertyvalue</P>
      </Item>
      <Item ID="itemid...">
        <P>propertyvalue</P>
        <P>propertyvalue</P>
        <P>propertyvalue</P>
      </Item>
    </Items>
    <FilterIDO />
    <MoreItems>moreitems</MoreItems>
  </LoadCollection>
</ResponseData>

Element descriptions

Element Description
Cursor The response data can include a cursor value that is a "bookmark" in the collection, to tell where the retrieval stopped. If you want to make multiple requests using NEXT or PREV to retrieve data, include a single <cursor /> element in your FIRST request.

The response document provides a cursor value. Include the cursor value of the response document (as <cursor>value</cursor>) in the NEXT request document, so the system can tell where to start the next retrieval request.

Continue updating the cursor value as you provide additional NEXT or PREV requests.

A request of LAST should use an empty <cursor /> element.

Distinct Retrieves a set of data representing only the distinct combinations of properties requested.

For example:

<LoadCollection Name="MGCore.Users">
  <LoadType>FIRST</LoadType>
  <PropertyList>
    <UserID />
  </PropertyList>
  <Distinct />
</LoadCollection>
Filter This element restricts the result set and corresponds to the FILTER or FILTERPERM keyword in Design Mode. You can use simple expressions, such as property names, comparison operators, Boolean operators, and so on.

Some examples:

<Filter>CoNum like 'ABC%'</Filter>
<Filter>QtyOnHand < 20 AND Whse = 'OH'</Filter> 

Not allowed are things like subqueries, function calls, or anything else that could be used for an injection attack.

For cloud environments, filters are always validated in the cloud. For on-premises installations, you can disable validation using the Filter Validation process default.

In the response document, this element contains any IDO-level filter specifications that were used.

Item The ID attribute contains a value used within the system to identify the item.
LinkBy This element is similar to the LINKBY keyword. The information within this element tells how the child collection is linked to the parent collection.

For example:

<LinkBy>
  <PropertyPair Child="Item" Parent="Item" />
  <!-- Optional: More sets of PropertyPair tags -->
</LinkBy>
LoadCollection This element has these possible attributes:
  • Name - This is the name of the collection to be loaded (for example, GroupNames)
  • LoadCap - This attribute applies only to subcollections. This is the maximum number of subcollections to include in the returns.

    These are the valid values for this attribute:

    • -1 - Includes all subcollections
    • 1 - (Default) Only queries the subcollection records for the first parent item.
    • Any other number - Specifies the maximum number of subcollections to retrieve.
LoadType This element specifies one of these types:
  • FIRST
  • NEXT
  • PREV
  • LAST

The first time you submit a LoadCollection request, it must be called FIRST or LAST. For subsequent requests, you can use NEXT or PREV.

OrderBy

This element provides a comma-delimited list of properties that specify how the response document result set should be sorted. The DESC keyword can appear after a property name to sort that property descending.

For example:

<LoadCollection Name="MGCore.Users">
  <LoadType>FIRST</LoadType>
  <PropertyList>
    <UserID />
    <Username />
    <Location />
  </PropertyList>
  <OrderBy>UserID, Username</OrderBy>
</LoadCollection>
P (Property Value) For each item, this list contains values corresponding the properties listed.
PropertyList In request data, you only need to list the properties you want returned. Each property is used as an element. The response data mimics the request list.

For example:

<PropertyList>
  <Acct />
  <AcctUnit1 />
  <AcctUnit2 />
  <AcctUnit3 />
  <AcctUnit4 />
  . . .
</PropertyList>
ReadMode This element specifies the collection "read mode", which controls the isolation level used when executing queries. See the online help for "Process Defaults".

These are the valid attributes for this element:

  • ReadCommitted
  • ReadUncommitted
  • Default

If this element is empty or omitted, Default is assumed. If this element in the request is anything except Default, the read mode value appears in the response.

RecordCap This element specifies how many records are to be retrieved in one request.

These are the valid values:

  • -1 - (Default) 200 records are to be retrieved by system default. For other possible system record caps, see the online help topic "About caps".
  • 0 - No cap, all records are to be retrieved.
  • Any other number - The specified number of records are to be retrieved.
PostQueryCmd This element specifies a method to execute once for each row in the result set, after the query is completed. This is equivalent to the PQ option in Load/Save overrides and uses the same syntax.

For example:

<PostQueryCmd>
  MyPostQuerySp( Property1, Property2, REF Property3 )
</PostQueryCmd>

Example 1 - Basic Load Collection

This example request queries the user ID, username, and user description from the users table.

<IDORequest ProtocolVersion="6.03" SessionID="bde8caa4-1343-4808-9bca-ed844ffe7129">
  <RequestHeader Type="LoadCollection">
    <InitiatorType />
    <InitiatorName />
    <SourceName />
    <SourceConfig />
    <TargetName />
    <TargetConfig />
    <RequestData>
      <LoadCollection Name="UserNames" LoadCap="0">
        <PropertyList>
          <UserDesc />
          <UserId />
          <Username />
        </PropertyList>
        <LoadType>FIRST</LoadType>
        <RecordCap>-1</RecordCap>
        <Filter />
        <OrderBy />
        <PostQueryCmd />
      </LoadCollection>
    </RequestData>
  </RequestHeader>
</IDORequest>

This example response contains user information such as user ID, username, and user description from the users table.

<IDOResponse ProtocolVersion="6.03" SessionID="bde8caa4-1343-4808-9bca-ed844ffe7129">
  <ResponseHeader Type="LoadCollection">
    <InitiatorType />
    <InitiatorName />
    <SourceName />
    <SourceConfig />
    <TargetName />
    <TargetConfig />
    <ResponseData>
      <LoadCollection Name="UserNames" LoadCap="0">
        <PropertyList>
          <UserDesc />
          <UserId />
          <Username />
        </PropertyList>
        <LoadType>FIRST</LoadType>
        <RecordCap>-1</RecordCap>
        <Filter />
        <OrderBy />
        <PostQueryCmd />
        <Items>
          <Item ID="PBT=[UserNames] UserNames.DT=[2019-08-13 14:14:23.487] UserNames.ID=[919f93d7-2427-489a-b78b-839f37a757db]">
            <P>Will Smith</P>
            <P>38</P>
            <P>wsmiith</P>
          </Item>
          <Item ID="PBT=[UserNames] UserNames.DT=[2019-08-13 14:14:23.453] UserNames.ID=[122cb5af-c5fb-4109-a95b-a331cb4e258c]">
            <P>Juan Dela Cruz</P>
            <P>41</P>
            <P>jdelacruz</P>
          </Item>
        </Items>
        <FilterIDO />
        <MoreItems>false</MoreItems>
      </LoadCollection>
    </ResponseData>
  </ResponseHeader>
</IDOResponse>

Example 2 - Custom Load Collection

One variation of the LoadCollection request is to specify an IDO method for loading data into the collection. It includes these elements:

<CustomLoadMethod Name="methodname">
  <Parameters>
    <Parameter>parametervalue</Parameter>
    <Parameter>parametervalue</Parameter>
  </Parameters>
</CustomLoadMethod>

This example request queries the note content and description from the object notes table using the custom load method GetNotesSp.

<IDORequest ProtocolVersion="6.03" SessionID="bde8caa4-1343-4808-9bca-ed844ffe7129">
  <RequestHeader Type="LoadCollection">
    <InitiatorType />
    <InitiatorName />
    <SourceName />
    <SourceConfig />
    <TargetName />
    <TargetConfig />
    <RequestData>
      <LoadCollection Name="ObjectNotes" LoadCap="0">
        <PropertyList>
          <SpcnNoteContent />
          <SpcnNoteDesc />
        </PropertyList>
        <LoadType>FIRST</LoadType>
        <ReadMode>ReadCommitted</ReadMode>
        <RecordCap>-1</RecordCap>
        <Filter />
        <OrderBy />
        <PostQueryCmd />
        <CustomLoadMethod Name="GetNotesSp">
          <Parameters>
            <Parameter>UserNames</Parameter>
            <Parameter>4d6cb1eb-e4fc-4e12-aae8-95ff1086ee8c</Parameter>
          </Parameters>
        </CustomLoadMethod>
      </LoadCollection>
    </RequestData>
  </RequestHeader>
</IDORequest>

This example response contains the note contents and description from the object notes table.

<IDOResponse ProtocolVersion="6.03" SessionID="bde8caa4-1343-4808-9bca-ed844ffe7129">
  <ResponseHeader Type="LoadCollection">
    <InitiatorType />
    <InitiatorName />
    <SourceName />
    <SourceConfig />
    <TargetName />
    <TargetConfig />
    <ResponseData>
      <LoadCollection Name="ObjectNotes" LoadCap="0">
        <PropertyList>
          <SpcnNoteContent />
          <SpcnNoteDesc />
        </PropertyList>
        <LoadType>FIRST</LoadType>
        <RecordCap>-1</RecordCap>
        <Filter />
        <OrderBy />
        <PostQueryCmd />
        <Items>
          <Item ID="">
            <P>Send in your weekly report every Friday before leaving the office</P>
            <P>Weekly Report</P>
          </Item>
        </Items>
        <MoreItems>false</MoreItems>
      </LoadCollection>
    </ResponseData>
  </ResponseHeader>
</IDOResponse>

Example 3 - Nested Load Collection

LoadCollection requests can be hierarchichal. For example, this sample request queries the users and user emails table in a single request, by nesting the UserEmails IDO LoadCollection request inside the UserNames IDO LoadCollection request.

<IDORequest ProtocolVersion="6.03" SessionID="71e1c28d-4e00-495e-bff0-571b26179649">
  <RequestHeader Type="LoadCollection">
    <InitiatorType />
    <InitiatorName />
    <SourceName />
    <SourceConfig />
    <TargetName />
    <TargetConfig />
    <RequestData>
      <LoadCollection Name="UserNames" LoadCap="0">
        <PropertyList>
          <UserDesc />
          <UserId />
          <Username />
        </PropertyList>
        <LoadType>FIRST</LoadType>
        <RecordCap>-1</RecordCap>
        <Filter />
        <OrderBy />
        <PostQueryCmd />
        <LoadCollection Name="UserEmails" LoadCap="0">
          <LinkBy>
            <PropertyPair Parent="UserId" Child="UserId" />
          </LinkBy>
          <PropertyList>
            <EmailAddress />
            <EmailType />
          </PropertyList>
          <LoadType>FIRST</LoadType>
          <RecordCap>-1</RecordCap>
          <Filter />
          <OrderBy />
          <PostQueryCmd />
        </LoadCollection>
      </LoadCollection>
    </RequestData>
  </RequestHeader>
</IDORequest>

This example response contains a set of records retrieved from the users and user emails table.

<IDOResponse ProtocolVersion="6.03" SessionID="71e1c28d-4e00-495e-bff0-571b26179649">
  <ResponseHeader Type="LoadCollection">
    <InitiatorType />
    <InitiatorName />
    <SourceName />
    <SourceConfig />
    <TargetName />
    <TargetConfig />
    <ResponseData>
      <LoadCollection Name="UserNames" LoadCap="0">
        <PropertyList>
          <UserDesc />
          <UserId />
          <Username />
        </PropertyList>
        <LoadType>FIRST</LoadType>
        <RecordCap>-1</RecordCap>
        <Filter />
        <OrderBy />
        <PostQueryCmd />
        <Items>
          <Item ID="PBT=[UserNames] UserNames.DT=[2019-08-13 14:14:23.487] UserNames.ID=[919f93d7-2427-489a-b78b-839f37a757db]">
            <P>Will Smith</P>
            <P>38</P>
            <P>wsmiith</P>
            <LoadCollection Name="UserEmails" LoadCap="0">
              <PropertyList>
                <EmailAddress />
                <EmailType />
              </PropertyList>
              <LoadType>FIRST</LoadType>
              <RecordCap>-1</RecordCap>
              <Filter />
              <OrderBy />
              <PostQueryCmd />
              <Items>
                <Item ID="PBT=[UserEmail] ue.ID=[2732c8a5-1400-4417-88a4-28f6e8dcb9fd] ue.DT=[2019-08-13 14:12:57.393]">
                  <P>will.smith@infor.com</P>
                  <P>P</P>
                </Item>
                <Item ID="PBT=[UserEmail] ue.ID=[9916ae94-07ef-443b-8ae9-a9ce4e24b4b9] ue.DT=[2019-08-13 14:14:23.513]">
                  <P>wsmith@business.com</P>
                  <P>S</P>
                </Item>
              </Items>
              <FilterIDO />
              <MoreItems>false</MoreItems>
            </LoadCollection>
          </Item>
          <Item ID="PBT=[UserNames] UserNames.DT=[2019-08-13 14:14:23.453] UserNames.ID=[122cb5af-c5fb-4109-a95b-a331cb4e258c]">
            <P />
            <P>41</P>
            <P>jdelacruz</P>
            <LoadCollection Name="UserEmails" LoadCap="0">
              <PropertyList>
                <EmailAddress />
                <EmailType />
              </PropertyList>
              <LoadType>FIRST</LoadType>
              <RecordCap>-1</RecordCap>
              <Filter />
              <OrderBy />
              <PostQueryCmd />
              <Items>
                <Item ID="PBT=[UserEmail] ue.ID=[28685ab7-c635-4e86-b465-f21e6497a263] ue.DT=[2019-08-13 14:13:13.803]">
                  <P>juan.delacruz@infor.com</P>
                  <P>P</P>
                </Item>
              </Items>
              <FilterIDO />
              <MoreItems>false</MoreItems>
            </LoadCollection>
          </Item>
        </Items>
        <FilterIDO />
        <MoreItems>false</MoreItems>
      </LoadCollection>
    </ResponseData>
  </ResponseHeader>
</IDOResponse>