Popular Topics

# Tables in DriveWorksXpress

Let’s imagine you are doing a DriveWorks project where the number of holes in a part varies dependent on the model number. Something like this:

 Model Number # of Holes Model Name A 1 Kathy B 3 Anna C 7 Danella D 2 Marisa

Something like this is rather easy to do in DriveWorks Pro or Solo because you could do a lookup table, but in DriveWorksXpress we are limited to only IF/Then logic. Acording to most documentation I’ve seen, they would want you to write an equation in DriveWorksXpress that would look like this:

`IF(ModelNumber="A",1,IF(ModelNumber="B",3,IF(ModelNumber="C"`
`,7,IF(ModelNumber="D",2))))`

It reads: IF the ModelNumber is “A” then 1 ELSEIF the ModelNumber is “B” then 3 ELSEIF the ModelNumber is “C” then 7 ELSEIF the ModelNumber is “D” then 2. Perfectly legit rule, but as your table grows troubleshooting the equation does become more difficult.

Consider writing the equation like this:

`IF(ModelNumber="A",1,0)+IF(ModelNumber="B",3,0)+IF(ModelNumber=`
`"C",7,0)+IF(ModelNumber="D",2,0)`

This treats these IF statements as an equation, adding zeros if it isn’t the model number we are looking for. (If the model is “C”, the equation would be 0+0+7+0.) It’s a little longer, more to type, but I think it is much easier to read and change.

You can do the same thing with strings too! They would look like this:

`IF(ModelNumber="A","Kathy","")&IF(ModelNumber="B","Anna","")`
`&IF(ModelNumber="C","Danella","")&IF(ModelNumber="D","Marisa","")`