We have a GI called AR-Daily Sales History. We would like to, by using an IIF in the following manner.
=IIF(LEFT([ARInvoice.RefNbr],3) = 'INV', 'US',
IIF(LEFT([ARInvoice.RefNbr],3) = 'INT', 'INT',
IIF([ARInvoice.OrigDocAmt] < 0.00, 'CRM')))
If the RefNbr starts with an INV then its a US invoice, if INT then International. That part is covered. The issue starts when we get to the Credits. There are some credits that the RefNbr starts with an INV which makes it US but then the DocType is a Credit Memo but because of the INV it still comes across as US. Using the last line in its present form, I get an error message: “Index was outside the bounds of the array”. I’ve also attempted this coding: =IIF(LEFT([ARInvoice.RefNbr],3) = 'INV', 'US',
IIF(LEFT([ARInvoice.RefNbr],3) = 'INT', 'INT',
IIF(LEFT([ARInvoice.RefNbr],2) = 'CM', 'CRM',
IIF(LEFT([ARInvoice.RefNbr],3) = 'INV' AND LEFT([ARInvoice.DocType],5) = 'Credit', 'CRM', 'CRM')))) which still comes up as ‘US’.