Hi,
I'm having trouble getting this method to work. I'm trying to create a job that queries one database, generates an XML string from the results, and inserts that string in another database. I've got it to the point where it generates the XML header part, but the XML details aren't working. Basically, each header record can have any number of details, so what I've done is created 2 jobs:
Job 1
- Get a list of header records.
- Loop through the records. For each record:
- -- Generate the XML Header.
- -- Call Job 2 to generate the XML Details.
- -- Retrieve the XML Details from a job variable from Job 2.
- -- Generate the XML Footer.
- -- Combine the XML parts into a single XML string.
Job 2
- Nullify the XML Details job variable.
- Get a list of detail records for the current header record (primary key value passed from Job 1).
- Loop through the records. For each record:
- -- Generate the XML details for the current record and concatenate them to the XML Details job variable.
Step 4 of Job 2 is a "Set Variable" task, with the variable being "XML Detail", and the value being this:
{JOB(Active|Variable|XML Detail)}<TaskDetail><itemIdPart1>{JOB(Active|Variable|STYLE)}</itemIdPart1><locnIdPart1>{JOB(Active|Variable|LOCN)}</locnIdPart1><locnIdPart2>R</locnIdPart2><quantity>{JOB(Active|Variable|QTY)}</quantity><caseId>{JOB(Active|Variable|CARTON_ID)}</caseId><skuCaseQty>{JOB(Active|Variable|CASE_QTY)}</skuCaseQty><weight>{JOB(Active|Variable|WEIGHT)}</weight><volume>{JOB(Active|Variable|CUBE)}</volume><hndlingUOM>{JOB(Active|Variable|LABEL_TYPE)}</hndlingUOM><season></season><seasonYr>{JOB(Active|Variable|CARTON_TYPE)}</seasonYr><color>{JOB(Active|Variable|CASE_NBR)}</color><secondDim>{JOB(Active|Variable|PLT_ID)}</secondDim><sizeRange></sizeRange><sizePos>1</sizePos><dim1>0</dim1></TaskDetail>
As you can see, I'm trying to set the XML Detail variable to itself, concatenated with a bunch more XML tags. I do have "Translate value to constant in Variable when running" checked, but it's giving me an infinite loop error:
TranslateVariables->Infinite loop error on string: {JOB(Active|Variable|XML Detail)}<TaskDetail><itemIdPart1>{JOB(Active|Variable|STYLE)}</itemIdPart1><locnIdPart1>{JOB(Active|Variable|LOCN)}</locnIdPart1><locnIdPart2>R</locnIdPart2><quantity>{JOB(Active|Variable|QTY)}</quantity><caseId>{JOB(Active|Variable|CARTON_ID)}</caseId><skuCaseQty>{JOB(Active|Variable|CASE_QTY)}</skuCaseQty><weight>{JOB(Active|Variable|WEIGHT)}</weight><volume>{JOB(Active|Variable|CUBE)}</volume><hndlingUOM>{JOB(Active|Variable|LABEL_TYPE)}</hndlingUOM><season></season><seasonYr>{JOB(Active|Variable|CARTON_TYPE)}</seasonYr><color>{JOB(Active|Variable|CASE_NBR)}</color><secondDim>{JOB(Active|Variable|PLT_ID)}</secondDim><sizeRange></sizeRange><sizePos>1</sizePos><dim1>0</dim1></TaskDetail><TaskDetail><itemIdPart1>{JOB(Active|Variable|STYLE)}</itemIdPart1><locnIdPart1>{JOB(Active|Variable|LOCN)}</locnIdPart1><locnIdPart2>R</locnIdPart2><quantity>{JOB(Active|Variable|QTY)}</quantity><caseId>{JOB(Active|Variable|CARTON_ID)}</caseId><skuCaseQty>{JOB(Active|Variable|CASE_QTY)}</skuCaseQty><weight>{JOB(Active|Variable|WEIGHT)}</weight><volume>{JOB(Active|Variable|CUBE)}</volume><hndlingUOM>{JOB(Active|Variable|LABEL_TYPE)}</hndlingUOM><season></season><seasonYr>{JOB(Active|Variable|CARTON_TYPE)}</seasonYr><color>{JOB(Active|Variable|CASE_NBR)}</color><secondDim>{JOB(Active|Variable|PLT_ID)}</secondDim>
<snip>
On another note, if anyone has an idea of an easier way to generate an XML string, I'd love to hear it.
Thanks.