KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Get a total count on relateOne and relateMany records in ORDA
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: November 20, 2023



Given an example of the above structure, to find out the total number of relateOne or relateMany records in ORDA can be done as follows:

// Get the total number of relateOne records
entitySelection.relatedOne.length

// Get the total number of relateMany records
entitySelection.relatedMany.length



Below is an example based on the given structure:

$es:=ds.Orders.all()

// Get the total number of customer based on an
// entity selection on the Orders table
$totalCustomer:=$es.customer.length

  // Get the total number of line items based on an
  // entity selection on the Orders table
$totalOrderLines:=$es.orderLines.length