Many Cards Versus One Card and a List Field
Mark Smith
mark at maseurope.net
Wed Jan 16 06:22:55 EST 2008
Peter, this is untested, but might work reasonably quickly:
on getReport
put file dataFile into tData
set the itemdelimiter to "/"
repeat for each line L in tData
put word 4 of L & line (item 2 of word 5 of L) of the
monthnames into tKey
add word 3 of L to tTotals[tKey]
end repeat
repeat for each line L in the keys of tTotals
put tTotals[L] into fld L
end repeat
end getReport
Best,
Mark
On 16 Jan 2008, at 06:47, Peter Alcibiades wrote:
> I have to admit to not having been able to make Rev work as a
> storage and
> retrieval language and am getting close to giving up after a couple
> of weeks
> hard trying. Its mostly the documentation probably. It must be
> possible
> since people on the list are doing it, but there seems no way to
> find out how
> from the documentation.
>
> The problem is not storage. Nor is it retrieval. It is reporting.
>
> Its a childishly simple problem. There is a file with 15k
> records. Tab
> delimited. Each record has five fields and is of the form:
>
> number eg 123
> description eg Pen, Pencil
> price eg 2.00
> category eg AA, AB...
> date eg 12/4/2008, 21/5/2008 (UK style)
>
> We then have 30 fields, which are the combination of a category and
> a month.
> So for instance we need to look at each record, if and only if it
> has both AA
> in item 4 and /4/ in item 5, then add the price item 3 to field
> AAApril. If
> and only if it has both AA and /5/ then add it to AAMay, and so on. 6
> months, five categories = 30 fields..
>
> Its a five minute job in a spreadsheet, but its defeated me for a
> couple of
> weeks now in Rev.
>
> There must be a way of combining switch, break and if-then to do
> this. The
> different ways I've tried sometimes go into loops. Sometimes they
> accumulate, as if case is leading it to retain previous totals and
> add new
> match totals to them. Sometimes they put all zeros into the fields.
> Sometimes half the fields go blank when I know there are matches.
> Sometimes
> it records half of the AAs, or a quarter. Sometimes it works with
> some of
> the months, or some of the categories.
>
> What is also deeply discouraging is that even can one get through
> this, there
> will be the problem of how to make Rev print it in Linux. This seems
> insuperable. It doesn't see the installed printers. Like it
> doesn't see the
> installed fonts. No idea why, everything else does. Maybe going
> out to the
> shell and using a2p will work? Maybe a different distro than
> debian? But
> this could well be another black hole....
>
> Peter
> _______________________________________________
> 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