0

Formalae for Summing products selected

Hi All,

I currently have a Multiple choice field (Show as Radio Buttons) where the staff can select multiple products that the clients has chosen to Purchase.

Example

Hammer - $5

Spanner - $3 

Nails - $10

What formalae should i use to sum up the total cost of the selected products

example the 1 customer bought a hammer = total cost $5

another customer bought a hammer and nails. = total cost $15

Ive been trying if functions but can't seem to wrap my head around it.

1 reply

null
    • Lars
    • 2 yrs ago
    • Reported - view

    It depends ... 

    I'd propose to use a dynamic multiple choice (DMC) field 'Multiple Choice' in one table. Then you store your products in another table 'Products'. 'Products' has at least two fields, 'Name' and 'Price'.

    For the DMC, you use "select Products" as dynamic value in the config popup. As name of the dynamic value, you select 'Name'. 

    The total is then 

    let prods := numbers('Multiple Choice');
    let total := 0;
    for i in prods do
        total := total + record('Products',number(i)).Price;
    end;
    total

Content aside

  • 2 yrs agoLast active
  • 1Replies
  • 30Views
  • 2 Following