kevinguthrie
IS-IT--Management
I am trying to figure out how to have Crystal Reports retrieve the data in one field in a table if another field in that same row in the table matches a specific value. I'm not sure if I'm writing the formula incorrectly or if I did something wrong when I linked the table. Ultimately, I would like to display on the printed invoice whether the invoice is to be emailed or sent via US mail. The formula I am using is as follows:
if (not(isnull({AR_CustomerDocuments.CustomerNo}))) AND ({AR_CustomerDocuments.Document}="S/O Invoice" AND {AR_CustomerDocuments.EmailDocument}="Y") then
"Email"
else
"US Mail"
The problem is that the CustomerNo field may or may not be in the AR_CustomerDocuments table, or it may be there several times for several different "Document" types. I am only interested in the "EmailDocument" field for the specific row which has the correct customer number from the invoice and the correct document type ("S/O Invoice") in the "Document" field. It seems that the formula retrieves data from the correct field, but isn't always in the correct row for the correct document type.
Here are screen captures of the table in question and my links:
Does anybody have any suggestions on how I can accomplish this? I must be missing something.
Thanks in advance!
Kevin
if (not(isnull({AR_CustomerDocuments.CustomerNo}))) AND ({AR_CustomerDocuments.Document}="S/O Invoice" AND {AR_CustomerDocuments.EmailDocument}="Y") then
"Email"
else
"US Mail"
The problem is that the CustomerNo field may or may not be in the AR_CustomerDocuments table, or it may be there several times for several different "Document" types. I am only interested in the "EmailDocument" field for the specific row which has the correct customer number from the invoice and the correct document type ("S/O Invoice") in the "Document" field. It seems that the formula retrieves data from the correct field, but isn't always in the correct row for the correct document type.
Here are screen captures of the table in question and my links:
Does anybody have any suggestions on how I can accomplish this? I must be missing something.
Thanks in advance!
Kevin