Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
i need some help with processing the Result of a tRestClient. The result looks like this in tLogRow:
ID;From;To;Half a day;Morning;User ID;Employee number;Type;Extra vacation day;State;Substitute state;Workdays;Hours;Medical certificate (sick leave only);Comments;User ID of the substitute
10358;13/04/2022;14/04/2022;false;false;12;143;Vacation;false;Approved;Approved;2.0;0.0; ; ;17
10086;07/03/2022;09/03/2022;false;false;17;146;Sickness;false;Done;Approved;3.0;0.0;true; ;12
My tRestClient returns only 3 columns in the response scheme: Statuscode, Body and String. In My tLogRow i only output the String. That means t
he result of the RestCall are already csv-delimited rows.
How can i process those rows, that i get the columns out of it? I'd like to avoid writing all those rows into a temporary file and read that file again. Is there another component i can use for that?
Kind regards
Actually, i didn't know that talend needs \\. I use
"(\\d*);(\\d\\d/\\d\\d/\\d\\d\\d\\d);(\\d\\d/\\d\\d/\\d\\d\\d\\d);(true|false);(true|false);(\\d*);(\\d*);(Sickness);(true|false);(.+);(.+);(\\d*.\\d*);(\\d*.\\d*);(true);(.+);(\\d*)"
now and it works fine.
Thanks everyone and kind regards
Hello,
You are able to extract the columns from the output response using regex via tExtractRegexFields/tJavaRow component in talend.
Best regards
Sabrina
Could you please provide an example for the tExtractRegexFields component? I understand what regex does, but i don't know how to get the columns out of the string by using the tExtractRegexFields.
Best regards
Holger
Hello,
You could extract the Statuscode (Approved), Body and String from the whole content using regex?
There is a component tExtractDelimitedFields which generates multiple columns from a delimited string column and then map all your inputs to required 3 outputs.
Best regards
Sabrina
@Holger Schleicher here is an example :
input string: "[Monday] meeting with john [priority: high] [place: office]"
regex pattern: "^\\[(\\w+)\\]([^\\[]+)\\[priority:\\s*(\\w+)\\]\\s*\\[place:\\s*([^\\]]+)\\]"
the pattern will match the string for 4 groups
so we define 4 columns as the output schema for tExtractRegexFields as the below
and the output is like the below
I tried to use
(\d*);(\d\d/\d\d/\d\d\d\d);(\d\d/\d\d/\d\d\d\d);(true|false);(true|false);(\d*);(\d*);([a-zA-Z]*);(true|false);([a-zA-Z]*);([a-zA-Z]*);(\d*.\d*);(\d*.\d*);([a-zA-Z]*|\s);([a-zA-Z]*|\s);(\d*)
as my Regex. In regex101.com it correctly splits my row into 16 parts.
In Talend i get this error:
Detail Message: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
According to java regexp my pattern is correct. What's talend complaining?
Kond regards
Actually, i didn't know that talend needs \\. I use
"(\\d*);(\\d\\d/\\d\\d/\\d\\d\\d\\d);(\\d\\d/\\d\\d/\\d\\d\\d\\d);(true|false);(true|false);(\\d*);(\\d*);(Sickness);(true|false);(.+);(.+);(\\d*.\\d*);(\\d*.\\d*);(true);(.+);(\\d*)"
now and it works fine.
Thanks everyone and kind regards