Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
HoS1
Contributor III
Contributor III

tRestClient and delimited results

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

Labels (2)
1 Solution

Accepted Solutions
HoS1
Contributor III
Contributor III
Author

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

View solution in original post

6 Replies
Anonymous
Not applicable

Hello,

You are able to extract the columns from the output response using regex via tExtractRegexFields/tJavaRow component in talend.

Best regards

Sabrina

 

HoS1
Contributor III
Contributor III
Author

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

Anonymous
Not applicable

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

 

Anonymous
Not applicable

@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

0695b00000Z21OcAAJ.pngand the output is like the below

0695b00000Z21OhAAJ.png

HoS1
Contributor III
Contributor III
Author

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

HoS1
Contributor III
Contributor III
Author

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