I would like to email a file attachment only if the number of rows is greater than zero.
If someone has done this with Version 7 I would greatly appreciate to know how.
eMail attached file if record count is greater than zero
Moderators: chulett, rschirm, roy
As per me, You will have to write a routine where you count the number of records in the file first( one way would be using DSGetLinkInfo and calculate the number of records passing through the link into the sequential file) and then if it is greater than zero call DSSendmail routine in that routine and attach the file. Then you can use this routine in a JobSequence.
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson
Welcome Aboard
As Kris mentioned, you will need to write a Basic routine to handle this.
Look into your BASIC guide and search for the STATUS command. Your concern will be the 6th field in the dynamic array that the STATUS command returns. Something like
where Arg1 = fully qualified path to your file
It will return you the file size. If it is non zero, then let the flow go to the notification activity with the attachment of the file.
As Kris mentioned, you will need to write a Basic routine to handle this.
Look into your BASIC guide and search for the STATUS command. Your concern will be the 6th field in the dynamic array that the STATUS command returns. Something like
Code: Select all
OPENSEQ Arg1 TO myfile
ELSE CALL DSLogWarn("Error opening file ":Arg1)
STATUS mystat FROM myfile THEN
Ans = mystat<6,1,1>
CLOSESEQ myfile
It will return you the file size. If it is non zero, then let the flow go to the notification activity with the attachment of the file.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Re: eMail attached file if record count is greater than zero
Look in the Routines (from DS Manager), possibly under the Utility or SDK section. There may be an example there (called something like SendEmail).jandersen wrote:I would like to email a file attachment only if the number of rows is greater than zero.
If someone has done this with Version 7 I would greatly appreciate to know how.
Rick H
Senior Consultant
Senior Consultant