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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
AndrewGuy
Contributor
Contributor

How can I convert a RAW ( Or LRAW) into sting ?

I want to read a SAP Table STXL which contains a RAW field and insert into a SQL Server table with type nvarchar. 

 

The Schema suggested converting the RAW into byte[] but how can I convert this to nvarchar ? 

 

Thank you in advance. 


Andrew 

Labels (2)
6 Replies
Anonymous
Not applicable

Have you tried this in your tMap? Create your String output column and use the code below (or similar) to convert the byte[] ....

new String(row1.yourRawByteArray, StandardCharsets.UTF_8)
AndrewGuy
Contributor
Contributor
Author

Hi Rhall_2_0 , 


Thanks for your input. When I tried adding what you've suggested , I get the error message "StandardCharSets cannot be resolved to a variable". 

I enclose a picture of what I've attempted - is that what you meant ? 


Screen Shot 2018-01-31 at 09.55.40.png
Anonymous
Not applicable

My mistake. You need to give it's full path unless you have previously imported it. To make it easy, just replace with this...

 

new String(row1.yourRawByteArray, java.nio.charset.StandardCharsets.UTF_8)
AndrewGuy
Contributor
Contributor
Author

One Step further.... thank you.... but I still appears to me to be just raw data rather than the character text. 

 


Screen Shot 2018-01-31 at 10.24.32.png
Anonymous
Not applicable

I can't help you without knowing more about the Raw data. It could just be the wrong character set that is being used in the conversion. I guessed UTF-8. Do you know the original character set? Do you know what the data should look like? Do you know if maybe it has been converted or encrypted? The first thing I would do is look for the correct character set or just try others out if you cannot get the character set.

AndrewGuy
Contributor
Contributor
Author

The solution was not to attempt to read RAW but to use the RFC_READ_TEXT object which would then return the text in an XML DOC structure. 0683p000009M2yX.png

With thanks to Chetan!