StageVar
Moderators: chulett, rschirm, roy
StageVar
My test file looks like this
123
234
07 "IMPORTANT LABEL 1' some totals
345
456
07 "IMPORTANT LABEL 2' some totals
What I need to do, is put the IMPORTANT LABEL on each line of the data I load. The Label is always at the end of the data. The line with IMPORTANT LABEL always starts with '07'.
so my hash file should be
123 IMPORTANT LABEL 1
234 IMPORTANT LABEL 1
345 IMPORTANT LABEL 2
456 IMPORTANT LABEL 2
123
234
07 "IMPORTANT LABEL 1' some totals
345
456
07 "IMPORTANT LABEL 2' some totals
What I need to do, is put the IMPORTANT LABEL on each line of the data I load. The Label is always at the end of the data. The line with IMPORTANT LABEL always starts with '07'.
so my hash file should be
123 IMPORTANT LABEL 1
234 IMPORTANT LABEL 1
345 IMPORTANT LABEL 2
456 IMPORTANT LABEL 2
In server jobs this can be done in several ways, I would do it with a transform stage followed by a named pipe. The stage variables would be
IsLabel = IF In.ColumnData[1,2]='07' THEN FIELD(FIELD(In.ColumnData,'"',2),"'",1) ELSE ''
OutputString = IF IsLabel THEN EREPLACE(CollectionString,@FM,',"':IsLabel:'"':CHAR(10))
CollectionString = IF IsLabel THEN '' ELSE CollectionString:@FM:In.ColumnData
Output Constraint "IsLabel"
This generates the data in the format
Then output of the transform goes to a named pipe declared with just one column as input. The output would have 2 columns, the data then the label as varchar with normal UNIX line terminators and the label column having surrounding quotes.
IsLabel = IF In.ColumnData[1,2]='07' THEN FIELD(FIELD(In.ColumnData,'"',2),"'",1) ELSE ''
OutputString = IF IsLabel THEN EREPLACE(CollectionString,@FM,',"':IsLabel:'"':CHAR(10))
CollectionString = IF IsLabel THEN '' ELSE CollectionString:@FM:In.ColumnData
Output Constraint "IsLabel"
This generates the data in the format
Code: Select all
123,"IMPORTANT LABEL 1"
234,"IMPORTANT LABEL 1"
etc...
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>