Visual Basic Demo

Input VBA, translate to CFL, run code & see output
Presentation
image.png
SELECTOR:
USA
TOTAL:
7464
Reset!
VBA
1
Search
VisualBasic
Run
Coda
Output
1
for C = 1 to count(CUSTOMERS)
if CUSTOMERS.Region[C]=SELECTOR then
for each ORD in CUSTOMERS[C].ORDERS
print ‘Cust:’+CUSTOMERS.ID[C]+’→Ord:’+ORD.OrdNumber
for each P in ORD.Products
if P.DeliveryType=2 then
print “—→Prod:”+P.ID+’→’+P.Price
TOTAL = TOTAL+P.Price
end if
next P
next ORD
end if
next C
Run!
runactions(_noop(),sequence(1,count(CUSTOMERS)).formulamap(withname(currentvalue,C,runactions(_noop()
,switchif(CUSTOMERS.Region.nth(C)=SELECTOR,runactions(_noop()
,CUSTOMERS.nth(C).ORDERS.formulamap(withname( currentvalue,ORD,runactions(_noop()
,PRINT.addrow(Print,‘Cust:’+CUSTOMERS.ID.nth(C)+’→Ord:’+ORD.OrdNumber)
,ORD.Products.formulamap(withname( currentvalue,P,runactions(_noop()
,switchif(P.DeliveryType=2,runactions(_noop()
,PRINT.addrow(Print,“—→Prod:”+P.ID+’→’+P.Price)
,TOTAL.setcontrolvalue(TOTAL+P.Price)
))
)))
)))
))
))))
Cust:C11111111 →Ord: o666666
—→Prod:P6666→456
—→Prod:P2222→200
—→Prod:P9999→432
Cust:C33333333 →Ord: o000000
—→Prod:P3333→300
—→Prod:P6666→456
—→Prod:P9999→432
Cust:C33333333 →Ord: o888888
—→Prod:P3333→300
—→Prod:P5555→123
—→Prod:P6666→456
—→Prod:P8888→321
Cust:C33333333 →Ord: o666666
—→Prod:P6666→456
—→Prod:P2222→200
—→Prod:P9999→432
Cust:C44444444 →Ord: o777777
—→Prod:P3333→300
Cust:C66666666 →Ord: o888888
—→Prod:P3333→300
—→Prod:P5555→123
—→Prod:P6666→456
—→Prod:P8888→321
Cust:C66666666 →Ord: o444444
—→Prod:P2222→200
—→Prod:P3333→300
—→Prod:P5555→123
—→Prod:P6666→456
—→Prod:P8888→321
There are no rows in this table
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.