Page 1 of 1

If, Then, Else Statement

Posted: 11 Feb 2020, 14:35
by AnnieVic
Good afternoon,

I am currently designing a Sage report for importing as a csv to a courier app for international customs invoices and am looking for help with If, Then, Else Statements.

On Sage I have designated INVOICE.NOTES_2 as the 'cell' in which a 'Y' should be placed by the user if a customs invoice is required. If the cell has a 'Y' then a series of information needs to included in the csv, if not 'Y', then leave it blank or "". The expressions I have created are:

INVOICE.NOTES_2 in ("Y","y")? "Commercial" : ""
INVOICE.NOTES_2 in ("Y","y")? INVOICE.INVOICE_NUMBER : ""
SALES_DEL_ADDR.COUNTRY_CODE in("AU")? "N" : ""
INVOICE.NOTES_2 in ("Y","y")? "GB550187XXXXXX" : ""
INVOICE.NOTES_2 in ("Y","y")? "GB" : ""
INVOICE.NOTES_2 in ("Y","y")? "0.00" : ""
INVOICE.NOTES_2 in ("Y","y")? INVOICE.ANALYSIS_1 : ""
INVOICE.NOTES_2 in ("Y","y")? SALES_DEL_ADDR.VAT_REG_NUMBER : ""
INVOICE.NOTES_2 in ("Y","y")? SALES_DEL_ADDR.TELEPHONE : ""
INVOICE.NOTES_2 in ("Y","y")? SALES_DEL_ADDR.E_MAIL : ""

The problem is, whilst the expression is accepted, it produces a blank csv

Thanking you in advance.
Ann

Re: If, Then, Else Statement

Posted: 11 Feb 2020, 15:50
by brucedenney
Can you attach your layout to a post so I can have a look at what you have done.

I would expect you to get a lot of empty fields at the very least.

Re: If, Then, Else Statement

Posted: 11 Feb 2020, 15:58
by AnnieVic
Hi Bruce,

Please find attached.

Re: If, Then, Else Statement

Posted: 11 Feb 2020, 16:55
by brucedenney
After removing the Sales_del_addr table I got it to work, but you seem to be reliant on data stored in the table, which you can't really reliably link to.

The "Bodge" method of linking it to relies on the address in the table being the same as the one on the invoice.

Did your source data have matching records for the Delivery Address in the Sales_del_addr table. I.E. that had exactly the same address?

Re: If, Then, Else Statement

Posted: 13 Feb 2020, 15:50
by AnnieVic
Hi, Thank you so much for the V3 copy.

Yes is the answer to the address question.

Re: If, Then, Else Statement

Posted: 13 Feb 2020, 16:50
by brucedenney
If the addresses are exactly the same then the original should have worked.