Help with switch statement error

I am getting an error on a switch statement that checks a field for a value. if the value matches then calculates a formula. So lost and appreciate any help.

switch({Table Data Code}, D2710, {Table Data Paid}.5, D2712, {Table Data Paid}.5, D2740,{Table Data Paid}.5, D2750,{Table Data Paid}.5, D2752,{Table Data Paid}.5, D2799,{Table Data Paid}.5, D5110,{Table Data Paid}.5, D5120,{Table Data Paid}.5, D5130,{Table Data Paid}.5, D5140,{Table Data Paid}.5, D5211,{Table Data Paid}.5, D5212,{Table Data Paid}.5, D5213,{Table Data Paid}.5, D5214,{Table Data Paid}.5, D25225,{Table Data Paid}.5, D5226,{Table Data Paid}.5, D5282,{Table Data Paid}.5, D5283,{Table Data Paid}.5, D5284,{Table Data Paid}.5, D5286,{Table Data Paid}.5, D5511,{Table Data Paid}.5, D5512,{Table Data Paid}.5, D5520,{Table Data Paid}.5, D5611,{Table Data Paid}.5, D5612,{Table Data Paid}.5, D5630,{Table Data Paid}.5, D5640,{Table Data Paid}.5, D5650,{Table Data Paid}.5, D5660,{Table Data Paid}.5, D6240,{Table Data Paid}.5, D6242,{Table Data Paid}.5, D6245,{Table Data Paid}.5, D6750,{Table Data Paid}.5, D6752,{Table Data Paid}.5, D6740,{Table Data Paid}.5, D1999,{Table Data Paid},{Table Data Paid}.4)

Respectfully, I would not use a formula like that. I would make your {Table Data Code} the primary key of a new table and have a field that holds that multiplier value in your switch statement. Change the {Table Data Code} to a linked field and bring along the multiplier as a lookup field. Then your formula gets much simpler and is more easily maintained.

Good luck either way.

1 Like

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.