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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
himanshup
Contributor III
Contributor III

How to replicate sql subscript function

Hi.

I have a T-sql subscript statement as:

substring('StrA',1,charindex(' ','StrA')-1)  

How do I make that work in Talend tMap component?

Thank you for your suggestions.

 

 

Labels (2)
1 Solution

Accepted Solutions
fcolagiacomo
Contributor III
Contributor III

Hi, 

you have to connect an input flow to tMap, then you drag your field onto output flow field.

In output field you can use the follow code:

StringHandling.LEFT(row1.field1, StringHandling.INDEX(row1.field1," "));

where row1.field1 is the field to process as your string 'StrA'.

In attachments you can see a simulation and the output in log (see tFixedInput as a SQL Server input component, field1 as a field of SQL Server record). 

I hope I understood well and this is useful for you.

View solution in original post

2 Replies
fcolagiacomo
Contributor III
Contributor III

Hi, 

you have to connect an input flow to tMap, then you drag your field onto output flow field.

In output field you can use the follow code:

StringHandling.LEFT(row1.field1, StringHandling.INDEX(row1.field1," "));

where row1.field1 is the field to process as your string 'StrA'.

In attachments you can see a simulation and the output in log (see tFixedInput as a SQL Server input component, field1 as a field of SQL Server record). 

I hope I understood well and this is useful for you.

fcolagiacomo
Contributor III
Contributor III

This code will work with also string without spaces:

 

StringHandling.INDEX(row1.field1," ") > 0 ?

StringHandling.LEFT(row1.field1, StringHandling.INDEX(row1.field1," "))

:

""