formatting data
Jim Ault
JimAultWins at yahoo.com
Wed Nov 1 22:19:27 EST 2006
I get it, you have designed a table with a field as each cell.
Part of the catch to this is that you have to rely on the naming scheme of
the cells (fields) to get the data. the following will construct all the
possible names of the cell-fields and load the values into the proper place
in the output, then remove the empty lines.
I am leaving the commas in so you can view the empty cells, if any.
on testt
put empty
put the number of fields into maxx
repeat with cc = 1 to maxx
repeat with rr = 1 to maxx
if there is a fld ("c"&cc&"r"&rr) then
put fld ("c"&cc&"r"&rr) into item cc of line rr of combinedValues
put cc && rr & cr after msg
end if
end repeat
end repeat
filter combinedValues without empty
put combinedValues after msg
--replace comma with space in combinedValues
--put combinedValues into fld combinedOutput
end testt
Modify this to suit your needs.
Jim Ault
Las Vegas
On 11/1/06 5:40 PM, "Robert Mann" <robmann at gp-racing.com> wrote:
> Jim
> what I have is a to columns of fields with many rows
> fld c1r1 would have 6 in it
> fld c2r1 would have 25 in it
> fld c1r2 and c2r2 would have nothing in them
> fld c1r3 and c2r3 would have nothing in them
> fld c1r4 would have 4 in it
> fld c2r4 would have 26 in it
> fld c1r5 would have 3 in it
> fld c2r5 would have 22 in it
> so if you were looking at the fields you would see
> 6 25
> empty flds
> empty flds
> 4 26
> 3 22
>
> what I would like to be able to do is put the data into a new fld
> reformatted like this without the empty flds
> 6 25
> 4 26
> 3 22
>
More information about the use-livecode
mailing list