Display “No records found” in a QMQRY

5 pts.
Tags:
AS/400 error messages
AS/400 printing
QMQRY
I have a QMQRY that selects data from several files using left joins. Based on my "where" clause there is a possibility that no records will be selected. In this case, I want to be able to print "NO RECORDS FOUND" on the report. I have not been able to figure out how to get that text to print on the report. Any suggestions?
ASKED: April 8, 2009  1:38 PM
UPDATED: April 10, 2009  1:54 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

You should be able to check the number of records in the output file via the Count(*) function to see whether to print that message, or possibly a pre-select using that same function to see if there are any records which meet your criteria – but as far as how to actually print that message, I am not aware of a way to do that either with QM or with Query/400. It does’t appear that either one supports conditional logic in the report options or allows adding a custom text message.

================================================================================
Here is a thought. Inside of your query do you have some type of description or message field that is being filled from one of hte physical file fields? If so then using a Case Statement you could place your
message in that field if you find that a specific field from each of the other files is null. For Example

Case
When FILEA.FIELD1 is null and
FILEB.FIELD2 is null and etc. (More conditions)

then “NO RECORDS FOUND”

Else FILEA.FIELD1

END

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following