We recently had to move a few products into different product families, and now I need to change this snip of code from:
if (UnitType == 'New Unit')
wherestr += 'And Family != \'Refurbished\' ';
else if (UnitType == 'Refurbished Unit')
wherestr += 'And Family = \'Refurbished\' ';
to something with and OR statement to exclude or include (respectively) a second product family of Spare Parts.
if (UnitType == 'New Unit')
wherestr += 'And Family != \'Refurbished\' OR \'Spare Parts\' ';
else if (UnitType == 'Refurbished Unit')
wherestr += 'And Family = \'Refurbished\' OR \'Spare Parts\' ';
11 answers
Gotcha!
Try this:
if (UnitType == 'New Unit')
wherestr += 'AND (Family != \'Refurbished\' OR Family != \'Spare Parts\') ';
else if (UnitType == 'Refurbished Unit')
wherestr += 'AND (Family = \'Refurbished\' OR Family = \'Spare Parts\') ';