Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Integration Manager and Queries with No records

Status
Not open for further replies.
Mar 12, 2003
678
US
Does anyone know of a way to have Integration Manager not run an Integration if the source query returns no records? I run a scheduled task for Integrations and have an e-mail send me an attachment stating whether the integration was successful or not. The problem is that if the query has no records I still receive an e-mail that states the Integration was successful. This is a false postive. Or does any one know of a script that I could put in the E-mail subject to show the query amount. Any help would be great.
 
When and where are you generating the email?

1. With VBScript within the Integration itself?

If so, use the After Document and After Document Error sections to increment variables (SETVariable, GetVariable) that you can use to report in the After Integration vbscript section to be included in your email.


2. Another line in the batch file of the scheduled task?

Which runs sfter the integration has completed?
If so, change the integration's log to go to a text file in a specific folder. (The default is the IM database)
Before the integration is launched, ensure that folder is empty (by moving or deleting the files).
After the integration has completed, attach any files from that folder to your email. You can then open the attachment to view the number of records integrated.
 
I have a vb script generating the email with the log file attached, but what i want is for the integration not to generate an e-mail if there are nor source records.
 
Ok, what you need to do is scan the log file for the line 'Source Records' or similar and extract the number that would be present after it.
If its zero, don't send the email.

How to scan the log file?
Since you are already using VBScript, use the fso object to open the file, read each line, see if that line contains the text you are after. If so, extract the count, otherwise, read next line.

I have used the inbuilt command FIND from a batch file to scan the log file and determine whether a given integration succeeded or failed, and move the log file to a SUCCESS or FAILED sub-folder, given I had over 200 integrations to be run.

I do not have a copy of the batch file readily available to show you how I did this using the FIND command.

------
Robert
 
Robert,

That is very handy. can you post the batch file later. It will be very helpful.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top