James,
jnoneiliv1: I think answering this question in terms of typical SQL statement logic might help clear things up.
While it's helpful to answer in terms of SQL statement logic, we're not writing a SQL statement so I wanted to try and explain what distinct means outside a SQL statement.
jnoneiliv1: This is still a bit confusing since typically SQL Select Distinct might return unique values, but in the case of a Loop Through Table we are really talking about entire records that the Action will Loop through.
Not might, Distinct will always return Distinct (aka unique records in non-SQL language).
jnoneiliv1: So, we still need some explanation as to how this impacts record processing.
With regards to record processing, if you're looping through the table with a distinct by, you're only going to see records that match that distinct clause. It impacts your processing by looping through distinct (by) records only.
jnoneiliv1: ...if the properties for Sorting the records are configured in the Action properties then the DISTINCT option would select the first record from a group of duplicates as determined by the sort criteria? This could be very handy to grab the most recent record for example the last invoice issued a customer.
When Looping Through a Table your Distinct clause has an optional Order By condition. Without the Order By condition then it would Order them By entry in the table. The sort criteria you mentioned only applies to a the Loop Through Grid action and yes, it should pull the first record.
jnoneiliv1: How would this work for the Loop Through Grid Action since sort options are not available? Would it choose the first physical record in a series of dups?
Loop Through Grid by Distinct was producing inconsistent results which has been rectified as of the April version. If you need to use the Loop Through Grid with a Distinct value then please log out/in, switch to the latest version of Method and republish your screen.
jnoneiliv1: I think if we can try to relate the logic back to SQL and then explain how it might be a little different for how the Actions are using it we might have a shared language for defining the logic and how it might be used in a way we can all relate.
I try to answer these posts in the best technical and non-technical terms depending on the question. Since we're not writing a SQL statement in the Loop Through actions I wanted to make it clear that Distinct in this instance means unique (which is non-SQL programmer friendly).
jnoneiliv1: ...I think some grounding in basic relational database functionality is required to really develop custom action sequences with even moderate complexity.
I disagree with this statement. While technical knowledge is definitely helpful to developing custom action sequences, it's not required. We built Method to help non-technical folks develop business processes outside the bounds of QB while still allowing them to use QB as their accounting program. If you feel the language in the manual is too conversational then I'll discuss it with the team here. We're trying to balance technical and non-technical folks alike.
~C