Okay, this is a beast, and in no way good or generalized. It doesn't use the previous function, instead just going through line by line and flagging all the issues it sees in one pass. It should:
1. Flag any new ID that doesn't have just two items on the line. 2. Following that line, flag if the next line doesn't have just 3 items 3. Flag any line that doesn't have an ID 4. Flag any line that doesn't have a section. 5. Flag any line where the ID is a duplicate of any previous section, subsection or type. 6. Flag any line where the section is a duplicate of any previous id, subsection or type. 7. Flag any line where the subsection is a duplicate of any previous id, or section 8, Flag any line where the subsection is a duplicate of a previous type that was under a different subsection 9. Flag any line where the subsection is empty, unless it's line 1 or 2 of a new ID 10. Flag any line where the type is a duplicate of any previous id or section 11. Flag any line where the type is a duplicate of any previous subsection, unless that is the current subsection. 12. Flag any line where the type is a duplicate of any previous type. 13. Flag any line where the type is empty, unless it is line 1 or 2 of a new ID 14. Flag any line where OP1 or OP2 is not one of the allowed values, or they are the same. I might be missing some, but I think that's it. If you choose to use this feel free to check in with me with any questions. In the words of Gene Wilder, "It's alive! But watch for page breaks." function validateList aList put 0 into lineNumber put "DIV,1 MULT,1 PLUS,1 MINUS,1 COUNT,1" into OP split OP using space and comma repeat for each line L in aList add 1 to lineNumber put empty into lineError put L into W split W using tab -- Check to see if this should be the second line of an ID with three items if W[1] is empty then put " -- ID missing" & cr after lineError else if W[1] is lastID then put false into newID else if itemList[1][W[1]] is not empty then put " -- ID out of order" & cr after lineError if W[3] is not empty or W[4] is not empty then put " -- FIrst line of ID has wrong item count" & cr after lineError put 1 into itemList[1][W[1]] if itemList[2][W[1]] + itemList[3][W[1]] + itemList[4][W[1]] > 0 then put " -- ID is a duplicate" & cr after lineError put true into newID put W[1] into lastID end if end if if W[2] is empty then put " -- Section missing" & cr after lineError else if W[2] is not lastSection and itemList[2][W[2]] is not empty then put " -- Section out of order" & cr after lineError put 1 into itemList[2][W[2]] if itemList[1][W[2]] + itemList[3][W[2]] + itemList[4][W[2]] > 0 then put " -- Section is a duplicate" & cr after lineError put W[2] into lastSection end if if newID and W[3] is empty and W[4] is empty then put true into newSection next repeat end if if W[3] is empty then put " -- Subsection missing" & cr after lineError else if W[3] is not lastSubsection and itemList[3][W[3]] is not empty then put " -- Subsection out of order" & cr after lineError put 1 into itemList[3][W[3]] if itemList[1][W[3]] + itemList[2][W[3]] + itemList[5][W[3]] > 0 then put " -- Subsection is a duplicate" & cr after lineError put W[3] into lastSubsection end if if newSection then put false into newSection if W[4] is empty then next repeat put " -- Second line of new ID has wrong item count" & cr after lineError end if split W[4] using "|" if W[4][1] is empty then put " -- Type missing" & cr after lineError else if W[4][1] is not lastType and itemList[4][W[4][1]] is not empty then put " -- Type out of order" & cr after lineError if (W[4][1] is not W[3] and itemList[3][W[4][1]] is not empty) or itemList[1][W[4][1]] + itemList[2][W[4][1]] + itemList[4][W[4][1]] > 0 then put " -- Type is a duplicate" & cr after lineError put 1 into itemList[4][W[4][1]] if W[4][1] is not W[3] then put 1 into itemList[5][W[4][1]] put W[4][1] into lastType end if if OP[W[4][2]] is empty then put " -- OP1 is empty" & cr after lineError if OP[W[4][3]] is empty then put " -- OP2 is empty" & cr after lineError if W[4][2] = W[4][3] then put " -- OP values are the same" & cr after lineError if lineError is not empty then put lineNumber && L & cr & lineError & cr after R end repeat return R end validateList _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode