Inconsistent results in simple script

JOHN PATTEN johnpatten at me.com
Wed Nov 16 22:32:19 CET 2016


Thanks Everyone,

One follow up question, how is the script that Richard provided:

on mouseUp
  put fld "csv1" into tStudentArray
  split tStudentArray by cr and comma
  put fld "csv2" into tDeviceArray
  split tDeviceArray by cr and comma
  repeat for each key tStudentID in tStudentArray
     put tStudentArray[tStudentID] into tStudentName
     put tDeviceArray[tStudentID] into tDeviceID
     put tStudentID &","& tStudentName &","& tDeviceID &cr \
         after tCombinedList
  end repeat
  delete last char of tCombinedList -- trailing CR
  put tCombinedList into fld "Upload File"
end mouseUp

…find the correct line via the barcode in the serial number list?  


Is he using the array item [tStudentID] (which I believe is actually [tBarcodeID]) to key in on the content in both arrays?  So in a sense, it is doing a find this barcode, but in an array construct?

When you don’t use arrays very much, and you have old, slow, brute force scripting skills, arrays are kind of hard to wrap your head around. But I obviously see their advantages :)

Thank you!




> On Nov 16, 2016, at 1:08 PM, JOHN PATTEN <johnpatten at me.com> wrote:
> 
> Thanks Mike and Craig,
> 
> One of my challenges is the two lists do not mirror each other by barcode number. The barcodes are not on the same lines in each list. That is why I was running the “find barcode in list two.”  I have teachers and other staff in the list of serial numbers and I was hoping not to have to weed them out of my lists so that the two lists lined up.
> 
> Can I use an array and still search be barcode prior to doing the username and serial number?
> 
> /..Yes Craig, old HyperCard habits are hard to break, at least for me :) …/
> 
> Thank you!
> 
> John Patten
> SUSD
> 
> 
> 
>> On Nov 16, 2016, at 12:58 PM, Mike Bonner <bonnmike at gmail.com> wrote:
>> 
>> Craig is right, this is asking to be an array, though if you prefer a flat
>> file you can combine it at the end like so.
>> 
>> on mouseUp
>> repeat for each line tLine in field "csv1"
>>  put item 2 of tLine into tDataA[item 1 of tLine]
>> end repeat
>> 
>> repeat for each line tLIne in field "csv2"
>>  put comma & item 2 of tLine after tDataA[item 1 of tLine]
>> end repeat
>> combine tDataA with return and comma
>> 
>> /*
>> Places the following into tDataA
>> 11234,maryjane,SDKTHYUPTO9
>> 12234,stevesmith,SDTKLL54RR2
>> 12345,johndoe,SDTKNY12345
>> */
>> end mouseUp
>> 
>> On Wed, Nov 16, 2016 at 1:43 PM, JOHN PATTEN <johnpatten at me.com> wrote:
>> 
>>> Hi Craig,
>>> 
>>> I have about 1000 students that are in a library system showing them as
>>> having checked out an iPad. In the library system it uses the student
>>> username and the barcode as the item identifier.
>>> 
>>> I have another list that shows our iPads by barcode and serial number.
>>> 
>>> Unfortunately there is no way for me to pull a report that shows the
>>> student username and the device serial number in one report. So I was
>>> essentially searching for the barcode in both lists and then combining the
>>> username from one and the serial number from the other. Ultimately ending
>>> up with a list that consists of student username and device serial number.
>>> 
>>> I hope that is a little clearer.
>>> 
>>> Thank you!
>>> 
>>> John Patten
>>> SUSD
>>> 
>>> 
>>>> On Nov 16, 2016, at 12:22 PM, dunbarx <dunbarx at aol.com> wrote:
>>>> 
>>>> HI.
>>>> 
>>>> So, a single list. What is the relationship between the fact that a
>>>> particular barcode refers both to a student and a serial number? In other
>>>> words, if you had a single list, how would "12345" relate to both "john
>>> doe"
>>>> and "SDTKNY12345"?
>>>> Would you simply have two lines:
>>>> 
>>>> 12345,johndoe
>>>> 12345,SDTKNY12345
>>>> 
>>>> Also, I do not understand what you mean when you said:
>>>> 
>>>> "I have cut my username list down to about 30."
>>>> 
>>>> Does that mean that in your 1000 line first list, the usernames appear
>>> with
>>>> multiple barcodes? Or are those lines empty? Or is that list now only 30
>>>> lines long?
>>>> 
>>>> It looks like this begs for an array, but I am missing what you expect as
>>>> output. Whatever it is, the procedure will be simple. But I cannot even
>>>> start to advise about that procedure until I know what the answer is.
>>>> 
>>>> Craig
>>>> 
>>>> 
>>>> 
>>>> --
>>>> View this message in context: http://runtime-revolution.
>>> 278305.n4.nabble.com/Inconsistent-results-in-simple-script-
>>> tp4710376p4710377.html
>>>> Sent from the Revolution - User mailing list archive at Nabble.com.
>>>> 
>>>> _______________________________________________
>>>> 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
>>> 
>>> 
>>> _______________________________________________
>>> 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
>>> 
>> _______________________________________________
>> 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
> 
> 
> _______________________________________________
> 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




More information about the use-livecode mailing list