Making data run on multiple lines
Moderators: chulett, rschirm, roy
Making data run on multiple lines
Hi,
I have a single 100 char field, and i have values that needs to go into this that can be greater than 100. if the values go over 100 char i need it to break on to the next line and so and so on.. grouping done via sortnum
ex. using a 10 char field
sortnum, text
01 Dstage Ser
01 ver
02 Posting ne
02 w topic
the text Dstage Server is carrying onto the next line as it hits the 10 char limit and same for sortnum 02
any thoughts most welcome. thanks in advance
I have a single 100 char field, and i have values that needs to go into this that can be greater than 100. if the values go over 100 char i need it to break on to the next line and so and so on.. grouping done via sortnum
ex. using a 10 char field
sortnum, text
01 Dstage Ser
01 ver
02 Posting ne
02 w topic
the text Dstage Server is carrying onto the next line as it hits the 10 char limit and same for sortnum 02
any thoughts most welcome. thanks in advance
mark_e
Check this FAQ posting: viewtopic.php?t=88639
You can write out a single 'record' with record delimiters in all the right places such that, when the records are read back in, they break up into the pieces that you need.
You can write out a single 'record' with record delimiters in all the right places such that, when the records are read back in, they break up into the pieces that you need.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
the data is as such
DSLink2.f1 = 1
DSLink2.f2 = aaaaabbbbb
my job contains:
stage var:
char(10) -- svSeparator
DSLink2.f2[6,5] -- svText
Derivation
DSLink2.f1 -- col1
DSLink2.f2[1,5] :svSeparator: svText -- col2
if i don't have the col1 in the target i get what i need
aaaaa
bbbbb
but if i put col1 in there i get a blank value in the 2nd row
aaaaa
bbbbb 1
how can i either get a duplicated 1 value or better still the 1 in the 1st row with a blank in the 2nd
aaaaa 1
bbbbb
thanks again
DSLink2.f1 = 1
DSLink2.f2 = aaaaabbbbb
my job contains:
stage var:
char(10) -- svSeparator
DSLink2.f2[6,5] -- svText
Derivation
DSLink2.f1 -- col1
DSLink2.f2[1,5] :svSeparator: svText -- col2
if i don't have the col1 in the target i get what i need
aaaaa
bbbbb
but if i put col1 in there i get a blank value in the 2nd row
aaaaa
bbbbb 1
how can i either get a duplicated 1 value or better still the 1 in the 1st row with a blank in the 2nd
aaaaa 1
bbbbb
thanks again
mark_e
If you have a finite width, say 1000, then breaking every 100 chars means up to 10 possible output links from a Transformer into a Link Collector and stage variables that divide up the data. You could go for the solution posted that scales better, but this might just be easier.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
You need to use 'code' tags to preserve spaces - your example made zero sense until I looked at what you originally posted.
Note the comma after the 'last' field. Write out this single 'field' to a flat file as one long varchar field.
You have complete control over what is getting output. There shouldn't be any reason you can't get what you want. If you want 'a blank in the second record' - add it.Mark_E wrote:hi,
when i add other fields to the multiple lines question the format seems to go wrong, any ideas.
i.e. col1,col2
1, aaaaabbbbb
thanksCode: Select all
which i want to be 1 aaaaa bbbbb ends up as 1 aaaaa bbbbb
What is your column delimiter, a comma? Why not try something like this...the data is as such
DSLink2.f1 = 1
DSLink2.f2 = aaaaabbbbb
my job contains:
stage var:
char(10) -- svSeparator
DSLink2.f2[6,5] -- svText
Derivation
DSLink2.f1 -- col1
DSLink2.f2[1,5] :svSeparator: svText -- col2
Code: Select all
OutputLink: DSLink2.f2[1,5]:",":DSLink2.f1:svSeparator:DSLink2.f2[6,5]:","
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers