Hi,

first, thanks to Gregg for his working sample for my question. 

trying it out i ran out of global variable space. Searching in escribe
brought up some threads on this, but no solution. 

So, am going to do it with blocks and nested blocks.

I made a large container block to put all the records in. Every record
starts with an record id, followed by a nested block containing up to several
blocks with date-informations, followed by three other values.

sample!!

allorders:[
     "3465436" [[["1.6.2002" "20:00:00" "1,00" "98,10"]] "1,00" "98,10"
"3004"]
]

now i have another record with the same id like this, read from a file:
3465436;20.06.2002 15:00:00;1,00;98,10;3004

if there is already a record in "all" i just want to add a new block like
this 
   ["20.06.2002" "15:00:00" "1,00" "98,10"]
to the nested block in the existing record and add 1,00 to the existing 1,00
and the 98,10 to the existing 98,10.

the final record should look like this:
"3465436" [[["1.6.2002" "20:00:00" "1,00" "98,10"]["20.06.2002" "15:00:00"
"1,00" "98,10"]] "2,00" "196,20" "3004"]

what happend is, for some reason i cannot find out, that the added block
overrides the existing one and is inserted a second time and the values are not
added.
so that the result is:
"3465436" [[["20.06.2002" "15:00:00" "1,00" "98,10"]["20.06.2002" "15:00:00"
"1,00" "98,10"]] "1,00" "98,10" "3004"]

Here is the code

Rebol []

orders: read/lines %AusgabeCSV.txt

if exists? %allorders.txt [delete %allorders.txt]

allorders: []
clear allorders
dates: []
date:[]

foreach full orders [   line: parse full ";"
                        head allorders
                        clear dates
                        clear date

                        either find allorders pick line 1 [
                              
                              
                                            insert date pick line 5
                              insert date pick line 4
                              insert date pick line 3
                              insert date pick line 2
                              insert/only dates date

                              sec: second allorders
                             
                              append/only sec/1 reduce dates
                         
                              sec/2: (to-integer sec/2) + (to-integer pick line 4)
        
                              sec/3: (to-money sec/3) + (to-money pick line 5)         
                 
                

                              ][

                              nom: pick line 1
                              
                              insert date pick line 5
                              insert date pick line 4
                              insert date pick line 3
                              insert date pick line 2
                              
                              insert/only dates date
                              
                              totquantity: pick line 4
                              totamount: pick line 5
                          info: pick line 6
                              
                                  insert/only allorders to-block reduce [:dates
:totquantity :totamount :info]                      
                               insert allorders nom
                             
                               ]
                      ]


print "Finished"


Any ideas

Thorsten




   

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to