Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Creator III
Creator III

Map string with "File Positional schema"

Hello, 
i have an input for my job and it's a String (i'm not reading file, just regular string).
I've made a "File Positional schema" for to be able split(map) my string to fields (columns) . 

What a component should i use to map my string.? 

simple example would be 
tJava------->[tMap ????]------->[tLogRow]
1line String------->mapping--------->n columns.

Easy-dirty solution is write down a String to a file and then with tFileInputPositional read/map the file (1 line) to my 10 columns.
But for me it's a dirty way, useless IO just to map some thing that i already have in memory.

can you guide me to a cleaner solution please.

thanks

Labels (2)
6 Replies
Anonymous
Not applicable

You can not use the schema defined in tFileInputPositional unless you are reading from a file. I will advise creating a User defined routine that can return you that structure by taking the string as an input and then you can use that function either in tJavaRow or tMap function.
_AnonymousUser
Creator III
Creator III
Author

To give a full picture:
i receive a message from a queue, then i passe this message to a job for future processing (get needed fields, and make some mapping, create an output message)
its really pity that i need to write it down (to a file) to be able to out map to a schema.
about routine, i wonted to avoid java functions (substring... and all ather manual work), because i can do a half of the work in java native. what is point to use an integration tool then. 0683p000009MPcz.png
 thanks anyway .
Anonymous
Not applicable

I did try few different things but unable to get any other approach working. I understand your point in reference to usage of Integration tool. I take it in different perspective that Integration tool is flexible enough to give you all these extra features 0683p000009MACn.png
_AnonymousUser
Creator III
Creator III
Author

thanks for your help,
but in my company we choose this tool, so everyone can understand and change jobs, even if they don't know java. 


so i'll  try to make a root that will have string input and and split it in 10 columns (output)

so colleagues can reuse it. 
_AnonymousUser
Creator III
Creator III
Author

hmm,

found this. talend outputstream so if i understand right it can write down to a stream (not a file). 
0683p000009MPcz.png i'm sad, i can't do it as inputstream. 
_AnonymousUser
Creator III
Creator III
Author

OMG. i think i got it.

There is a component tExtractPositionalFields, i don't know why when i searched for "positional" in Palette, i didn't saw it.
so i'll try to make it work, because i was on my way of making a Java parser for my mapping. 0683p000009MACn.png
have a nice day