strido wrote:At minimum, how would i get the metadata and export it to an XML? Is metadata auto-generated?
You don't need to export it as XML unless you need to use it in another application or something. You just need to get the information from your database accessible from Switch. This is done with Job Metadata and its a fundamental concept with Switch. As your job routes through your flow, it can pick up new metadata (private data declarations, database queries, checkpoint selections, etc...) which can be used for further routing. The configurator that handles the database query will do that for you. I don't know how the database module works, so I can't speak to that and perhaps that's where the confusion is coming from.
I can walk you through
this one. Even if you don't use it, perhaps the concepts will help you.
Set that script up with your odbc credentials. Use a direct query that you know is valid (hard code your variables):
Code: Select all
SELECT * FROM Jobs WHERE JobNumber = '123456'
Now, set the result type to dataset. Pass a job through it, but hold the job before a folder (to prevent Switch from removing the unique prefix which tracks its metadata). Now, stop the flow, modify
any connector to change the "include these jobs" and select "define condition with variables". Add a new left side condition, go to the Metadata category, then choose Text, then next to the Path field, click the arrow and "Build location path". Then, you should see a new window, click around in the external datasets and you should see the database information for job '123456'.
You can click on any of these variables and place them into the condition as a variable expression. When you're done with the left side, you can compare it to something, finalizing your connector condition. It's always good practice to have a secondary connector that has "All other jobs" when doing this.
Now that you've got the basics working, now you can make it work by replacing '123456' in your query with a Switch variable ([Job.PrivateData:Key="JobNumber"] perhaps). Better yet, you can replace it with a parametrized query which allow you to insert :jobNumber as placeholder and will attempt to remove special characters which could be used for SQL injection. All optional stuff you can get into later.