If (Right (Product,2)='81','Type A','Type B') as IsTypeAProduct
Drop Table Orders;
Table OrdersWithFlag will contain both the original product an indicator for product type (which here I've called IsTypeAProduct).
Loading the flag in the script may be the easiest in that it creates a flag that you can reference all throughout your document without having to rewrite the formula each time.
You can also add the above formula, for example, as an expression in a straight table chart (sans 'as IsTypeAProduct'), and it'll work. This may be the better solution if you don't want to mess with the script or only need the indicator in one or two place. The straight table will look like this: