formatting data
Robert Mann
robmann at gp-racing.com
Thu Nov 2 16:39:26 EST 2006
Thanks Jim this is great, I modified to this and I get the output that I
want
put empty
put 15 into maxxr
put 2 into maxxc
repeat with cc = 1 to maxxc
repeat with rr = 1 to maxxr
if there is a fld ("fcd"&rr&"qty") then
put fld ("fcd"&rr&"qty") into item 1 of line rr of combinedValues
put cc && rr & cr after msg
else
put " " into item 1 of line r of combinedValues -- tried this
thinking it would put a space in if no number
end if
if there is a fld ("fcd"&rr) then
put fld ("fcd"&rr) into item 2 of line rr of combinedValues
put cc && rr & cr after msg
end if
end repeat
end repeat
filter combinedValues without empty
replace "," with " " in combinedValues
put combinedValues after msg
put combinedValues into fld combinedOutput
16 30.1
29.1
28.1
27.1
26.1
25.1
24.1
23.1
22.1
21.1
20.1
19.1
18.1
30.5
16.2
is there a way to get the 29.1 to line up under the 30.1 if there is no data
in first field?
Robert Mann
President
GP Racing LLC
-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of Jim Ault
Sent: Wednesday, November 01, 2006 10:19 PM
To: How to use Revolution
Subject: Re: formatting data
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
>
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list