Use the Case function in your Total field calculation:
products_types = "type A" ; price_1 + price_2 ;
products_types = "type B" ; price_2 + price_3 ;
Thanks for your answer. When I put this final code, I always have this error message: The specified field cannot be found. And then, product_types is highlighted.
product_types = "Apparel" ; TRANSFERS::cost per transfer + TSHIRTSTOCK::tshirt_cost ;
product_types = "Picks" ; RAW_PICKS::raw_picks_cost + PACKAGE_BAGS::bags_cost + CARDS::cards_cost ;
Do I have to specify that is a valuelist or something else?
what is the name of the Field you are selecting either type A or type B in from the products_type value list?
that is the field you want to use.
whatever the name of that field is, use that in the calculation where you currently have "products_type"
i got it! I was using fixed values in my list.
I changed that so my valuelist get the values from the name field of TYPE table. I then make a relationship between this table and my products table, change the list name to field name in the code and that works now!
here's the code in case it could help someone:
TYPES::name = "Apparel" ; TRANSFERS::cost per transfer + TSHIRTSTOCK::tshirt_cost ;
TYPES::name = "Picks" ; RAW_PICKS::raw_picks_cost + PACKAGE_BAGS::bags_cost + CARDS::cards_cost ;