July 3, 200223 yr Example: A view has a list of items that have been ordered from a company. Each item is attached to an order with an order_id relating the items file to the orders file. How would I count the number of orders BEING VIEWED? That is, I need a global count of something like sum(unique(order_id)) Am I making any sense? Thanks for any help you beautiful people. -wald
July 4, 200223 yr Give each record an auto entered, sequential, ascending, unique record ID (RecordID). Create the relationship: SelfByOrderID with Order ID matching Order ID in the same file. Create a field: Flag (calculation, number) = (RecordID = Min(SelfbyOrderID::RecordID) The sum of Flag is the number of unique order id's. -bd
July 4, 200223 yr Not straightforward ... I'd use a script looping thru records, setting a global field to the order ID of the record and increasing another global field each time a different order ID is encountered .... or Copy the orderIDs of the selected records into a global text field, creating a multi-line key, relate this global field to the orderID of Orders and use a calc Count (ThisRelationship::OrderID)
July 16, 200223 yr Author That doesn't work because the min function gives the min of all entries in the table, not the min of the found set which is what I need. Any suggestions? I really don't want to use a loop, because that would slow things down too much. Thanks a bunch
Create an account or sign in to comment