Page 1 of 1

Finding something in a table field

Posted: Thu Apr 02, 2020 10:37 am
by richmond62
Table search.png
-

Code: Select all

on mouseUp
   set itemDelimiter to TAB
   ask "Search item?  "
   put it into SX
   put 1 into ELEVATOR
   repeat until ELEVATOR > 20
      put 1 into LATERAL
      repeat until LATERAL > 20
         put (item LATERAL of line ELEVATOR of fld "tf")  into XS
         if  (quotes & XS & quotes) = (quotes & SX & quotes) then
            put (SX && "in cell" && LATERAL & "," & ELEVATOR) into fld "rez"
         end if
         add 1 to LATERAL
      end repeat
      add 1 to ELEVATOR
   end repeat
end mouseUp
Well; I had fun anyway. 8)

Deleted stack as there is an "upgraded" (read "side-graded") version attached to the next posting.

Re: Finding something in a table field

Posted: Thu Apr 02, 2020 11:28 am
by richmond62
Table search 2.png
-
This Virus lockdown will make even types like me desperate to attract attention. 8)

Re: Finding something in a table field

Posted: Thu Apr 02, 2020 1:16 pm
by mrcoollion
Another way to do it
Put into a button and test. This one also looks for parts of the text.

Code: Select all

on mouseUp
   set itemDelimiter to TAB
   ask "Search item?  "
   put it into SX
   put lineOffset (SX,fld "tf") into ELEVATOR
   put itemOffset (SX,line ELEVATOR of fld "tf") into LATERAL
   put (SX && "in cell" && LATERAL & "," & ELEVATOR) into fld "rez"
end mouseUp
Here is a version that also includes a choice between whole match or not.
Find the square-2.zip
(1.66 KiB) Downloaded 211 times
Thanks had some fun with it :D

Regards,

Paul