Use the same job to loop through multiple origins: Difference between revisions

From Starfish ETL
Jump to navigation Jump to search
(Created page with "This example looks at reading from multiple mailboxes for email. Use a variable in the origin connection string. If the job needs to run for another mailbox, it calls the Go...")
(No difference)

Revision as of 20:17, 6 January 2017

This example looks at reading from multiple mailboxes for email. Use a variable in the origin connection string. If the job needs to run for another mailbox, it calls the GotoJob function in the “Once After Conn”.

Once Before Conn

object ScriptedVariable()
{
                string mb = Starfish.GetSetting("Mailboxes");
                Starfish.LogMessage(runCnt.ToString());
                mb = mb.Split(';')[runCnt].Split(',')[0];
                mailBox = mb;
                Starfish.LogMessage("Mailbox: " + mb);
                return mb;
}

Connection String:

@@VAR:vMailbox@@

Once After Conn

void CSharpProcedure()
{              
                if (!Starfish.PreviewMode)
                                Starfish.SaveSetting("Mail-LRD-"+mailBox, DateTime.Now.ToString());
                string mb = Starfish.GetSetting("Mailboxes");
                if (runCnt < mb.Split(';').Length-1)
                {
                                runCnt++;
                                Starfish.GotoJob("f54baebc-d128-4f9d-9d1a-ac7c88e027fe");
                }
}