Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Let
LET vFcst_Invoices =if($(InvoiceEveryTest)=-1,0,round($(vFcstMonths)/ $(vInvoiced_Every)));
InvoiceEveryTest = isnull(vInvoiced_Every);When my code hits a record where vInvoiced_Every is a null it falls over.
When I look at the debugger it shows that the first part of the if : $(InvoiceEveryTest)=-1 is -1 = -1
but it falls over I can not see why it does not change vFcst_Invoices to 0 as it is supposed to.
Can you suggest how I can stop this problem
I think that is dividing $(vFcstMonths) into null which causes an error. If you want to assign different values to vFcst_Invoices depending on the condition, you may try
LET vFcst_Invoices=if(isnull($(Invoice_Every)),0,round($(vFcstMonths)/$(vInvoiced_Every)));
So when $(Invoice_Every) gets a null value, vFcst_Invoices will take 0, otherwise, round value. Is that correct?