So came across a little problem in FIleMaker today. I had a list of values that I was processing in a loop. It turnes out, I needed to add another criteria to process the the list, this would make the list longer because it would need to have a list based on two fields instead of a list of one.
You can’t use Distinct() in SQL with Multiple fields, so I had to figure out a way to solve this without using another While inside the current While.
So this is the ExecuteSQL I was starting with.
E.g: ExecuteSQL ( “SELECT DISTINCT(checkNumber) FROM MRIJournalEntries WHERE status = 1”; “”; “” ))
So, to fix it and get a list of values this is what I came up with:
UniqueValues ( ExecuteSQL ( “SELECT checkNumber,idDepartment FROM MRIJournalEntries WHERE status = 1”; “”; “” ))
In the use case I’m working on, I have to create multiple records based on the check number AND the department in my while loop. This allows me to create a list I can process and because the “,” is considered a word separator, using getValue(leftWords(posts; 1); I + 1) would give me the check number and rightWords would give me the department. Thus saving the need to go through and put an additional while loop inside another while loop