[resolved] Cannot convert from char to string

Highlighted
One Star

[resolved] Cannot convert from char to string

Hi,
I'm trying to do a lookup on an incoming column which is string and the column from the lookup file is also a string.
The transformation on the main column  is as follows which is applied while doing the lookup.
StringHandling.LEFT(row1.main_column,2) 

The error thrown is Cannot convert from char to string.
I tried using the valueof method as well but no luck.
Any ideas please?
Thanks

Accepted Solutions
Highlighted
One Star

Re: [resolved] Cannot convert from char to string

Thank you for the response.
The issue was apparently not being caused by the substring function but actually an empty string that was being passed to a column in the tmap. Instead of using double quotes, single quote was used and hence the cryptic error message Smiley Happy.
Thanks again.

View solution in original post


All Replies
Highlighted
Community Manager

Re: [resolved] Cannot convert from char to string

Can you take a screenshot of your job and the tMap that you are carrying out this logic in? It seems an odd message for what you have described. Also, could you click on the "code" tab (in the bottom left of the Talend workspace) and look for a red block on the right hand side of the code window. Click on that to take you to the area of broken code. Take a screenshot of that and post it. That should give us enough information to help you. 
You may struggle to post screen shots as you have not posted enough. Just post a couple of comments under this message to get you up to 10 posts, then you will be able to post images.
Highlighted
One Star

Re: [resolved] Cannot convert from char to string

Thank you for the response.
The issue was apparently not being caused by the substring function but actually an empty string that was being passed to a column in the tmap. Instead of using double quotes, single quote was used and hence the cryptic error message Smiley Happy.
Thanks again.

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog