Weekend challenge

J. Landman Gay jacque at hyperactivesw.com
Sun Jun 30 23:37:17 EDT 2013


Cool. Note that in the sample data, the first two lines of the EF block 
are missing entirely, the ones that should have the empty values. Not 
sure how to call your function for that but I'm hoping you do. :)


On 6/30/13 8:33 PM, Geoff Canyon wrote:
> This is just one piece, but here's a function that takes a list much like
> yours and a list of columns, and returns the instances where a column
> repeats itself out of order. So this (note the true being passed to ignore
> empty values):
>
>     replace tab with comma in yourData
>     put isSequential(yourData,"1,2,3",true)
>
> will return something like:
>
> 25,2,3
> 26,2
> 37,1
> 140,3
> 155,1
> 156,1
> 163,2
>
> Which means that in line 25, items 2 and 3 were out-of-sequence repeats,
> etc.
>
> function isSequential theList,columnsToCheck,ignoreEmpties
>     put 0 into lineNumber
>     repeat for each line L in theList
>        add 1 to lineNumber
>        put lineNumber into lineErrorReport
>        repeat for each item i in columnsToCheck
>           put item i of L into thisItem
>           if ignoreEmpties and thisItem is empty then next repeat
>           if thisItem is lastItem[i] then next repeat
>           put thisItem into lastItem[i]
>           if itemsSeen[i][thisItem] is not empty then put comma & i after
> lineErrorReport
>           put 1 into itemsSeen[i][thisItem]
>        end repeat
>        if lineErrorReport is not lineNumber then put lineErrorReport & cr
> after R
>     end repeat
>     return R
> end isSequential
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list