&⍝ ]demo C:\Users\richard\Documents\Conferences\2023-03 FinnAPL online\script.txt
rootdir←'C:\Users\richard\Documents\Conferences\2023-03 FinnAPL online\'
fn_deliveries←rootdir,'Deliveries.csv'
fn_products←rootdir,'Products.csv'
&!

]box on -style=min
⊃⎕NGET fn_deliveries
⊃⎕NGET fn_products
csv←⎕CSV⍠('Separator' ';')('Decimal' ',')
(csv⍠'Invert' 0) fn_products '' (1 1 2) 1
⊃(csv⍠'Invert' 0) fn_products '' (1 1 2) 1
⊃(csv⍠'Invert' 1) fn_products '' (1 1 2) 1
⊃(csv⍠'Invert' 2) fn_products '' (1 1 2) 1
&'To slides

]box on -style=min
⊃(csv⍠'Invert' 2) fn_products '' (1 1 2) 1
product_code desc cost←⊃(csv⍠'Invert' 2) fn_products '' (1 1 2) 1
product_code
desc
cost
date delivery_code qty←⊃(csv⍠'Invert' 2) fn_deliveries '' (1 1 2) 1
date
delivery_code
qty
product_code ⍳ delivery_code
cost[product_code ⍳ delivery_code]
cost[product_code ⍳ delivery_code]×qty
+/cost[product_code ⍳ delivery_code]×qty
date
1 ⎕DT (2022 7 1 0 0 0 0) (2022 8 1)
1 ⎕DT ⊂2022 6 18 2 23 0
{2⊃' -:'⎕VFI ⍵}¨date
dn←⎕←1⎕DT{2⊃' -:'⎕VFI ⍵}¨date
(dn≥1⎕DT⊂2022 7 1)∧(dn<1⎕DT⊂2022 8 1)
mask←(dn≥1⎕DT⊂2022 7 1)∧(dn<1⎕DT⊂2022 8 1)
mask/date
mask/delivery_code
mask/qty
+/cost[product_code ⍳ mask/delivery_code]×mask/qty
&'To slides

]box on -style=min
⎕←d←csv fn_products '' 4
1(⎕JSON⍠'Compact' 0) ⊂2 d
⎕←d←csv fn_products '' (1 1 2) 1
1 ⎕JSON ⊂3 d
⎕←d←(csv⍠'Invert' 2)fn_products''(1 1 2)1
1 ⎕JSON ⊂4 d

&'End of part 1!