Use ORDA to query selection by related field

I’m converting some old code to ORDA and finding the conceptual shift a bit tricky (I’m a Bear of Very Little Brain).

The code loops through records in [Items] (which are dated), selecting a month at a time. [Items] is related to [Types]; the relations are ItemsToType and TypeToItems. Within each month’s worth of items, I want to find those of each of several types so I can sum [Items]Fee for that type. So in old money, having got the month’s selection in [Items], I do

USE SET("$thisMonth")
QUERY SELECTION ([Items];[Types]Type<3)
$sum1To3:=Sum([Items]Fee)

USE SET("$thisMonth")
QUERY SELECTION ([Items];[Types]Type=4)
$sum4:=Sum([Items]Fee)

and so on (the code itself looks a little different, but that’s the gist).

How would I do the equivalent in ORDA?

Jeremy

Never mind. As so often happens, the thought needed to frame the question was the thought needed to answer it as well.

Jeremy

1 Like