Chunk expressions

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Chunk expressions

Post by Nakia » Mon Mar 19, 2012 9:10 am

Hi,
I am trying to isolate the last number which I colored in red here(can be 1 or 2 digits with and without decimal point) in a variable to then post into a field line by line.. these numbers (ones in Red) change every time I need to run this function so looking for figures is out of the question..

container looks like this.. can anyone think of a combination of chuck expressions that would achieve this?

DATA=1 - 1 - -
DATA=2 - 0 - -
DATA=3 - 1.5 - -
DATA=4 - 0 - -
DATA=5 - 5 - -
DATA=6 - 0 - -
DATA=7 - 7 - -
DATA=8 - 0 - -
DATA=9 - 6.5 - -
DATA=10 - 0 - -
DATA=11 - 8 - -
DATA=12 - 0 - -

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Chunk expressions

Post by jmburnod » Mon Mar 19, 2012 9:37 am

Hi Nakia,

You can use the itemdel like this:

Code: Select all

on mouseUp
   put fld 1 into tData
   put empty into tTheValues
   put the itemdel into OID
   set the itemdel to "-"
   repeat for each line tline in tData
      put the value of item 2 of tline & return after tTheValues
   end repeat
   delete char -1 of tTheValues
   set the itemdel to OID
   put tTheValues
end mouseUp
Best regards

Jean-Marc
https://alternatic.ch

Nakia
Posts: 425
Joined: Tue Feb 21, 2012 8:57 am

Re: Chunk expressions

Post by Nakia » Mon Mar 19, 2012 11:36 am

Thanks,

this gave me enough to achieve what I needed.
Thank you...

Klaus
Posts: 14211
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Chunk expressions

Post by Klaus » Mon Mar 19, 2012 1:44 pm

Hi friends,

hint:
Since "item 2 of tLine" is NOT an expression that need to be eVALUEated, you can just write:

Code: Select all

...
  repeat for each line tline in tData
      put item 2 of tline & return after tTheValues
     ##  put the value of item 2 of tline & return after tTheValues
   end repeat
...
Best

Klaus

Post Reply