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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Remove extra charters from column

Hi All,

 

How i can remove the extra string/caracter from column using tmap.

 

Need to remove till 00:00:00  if exist  else ignore.

 

Colum1

28SEP 00:00:00 120

33

20DEC 00:00:00 24

 

Expected output.

colum1

120
33

24

 

Thanks

Shree

Labels (1)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

Here is a solution:

0683p000009Lrni.png

And the result:

Starting job test at 15:33 14/11/2017.

[statistics] connecting to socket on port 4011
[statistics] connected
.-----------+-----+-----+----.
|         tLogRow_13         |
|=----------+-----+-----+---=|
|col1       |col2 |col3 |col4|
|=----------+-----+-----+---=|
|CAID:A70-01|M-001|35/MA|90  |
|CAID:A70-01|M-001|37/MA|51  |
'-----------+-----+-----+----'

[statistics] disconnected
Job test ended at 15:33 14/11/2017. [exit code=0]

View solution in original post

10 Replies
TRF
Champion II
Champion II

Hi,
You may try this :
row1.column1.replaceAll ("^.*00:00:00 ", "")
Anonymous
Not applicable
Author

Hi @TRF,

 

I am getting java.lang.NullPointerException.

 

Both source and target are string data types.

 

Thanks

Shree

Anonymous
Not applicable
Author

Hi,

 

You have to probably handle null before writing the function.

 

Regards

Prasoon

TRF
Champion II
Champion II

Try using this one:

row1.column1 != null ? row1.column1.replaceAll ("^.*00:00:00 ", "") : null

 

Anonymous
Not applicable
Author

Thanks @TRF,

 

It's working now, there little change in the requirement. I am concatenation some columns then i want split single columns  into mutiple columns. 

 

Source:

Colu1                                                               ,   col2

01SEP00:00:00CAID:A70-01MAM-001,      004935/MA90

CAID:A70-01MAM-001,                               37/MAA/MA51

 

Expected output:

 

      Col1              col2        col3     col4

CAID:A70-01   M-001      35/MA   90

CAID:A70-01   M-001      37/MA   51

 

Rules:

colu1:

1) remove all character before CAID.

2) CAID:A70-01: Lenght of the character is fixed.

3) M-001: Lenght of the character is fixed.

 

Col2:

1) Point posiition "/". Extract before "/" 2 digit i,e  35 and 37.

2) /MA :  is fixed two digit.

3) 90: varience is charcter: curretly consider two digits.

 

Thanks

Shree

TRF
Champion II
Champion II

You should check how regex work with Java with the following link:

http://www.vogella.com/tutorials/JavaRegularExpressions/article.html

Should probably be easier using a tJavaRow than a tMap to solve your case.

Anonymous
Not applicable
Author

Hi @TRF,

 

Sure, Currently i am in middle logic.

 

Would be great if help me using tmap only.

 

Thanks

Shree

TRF
Champion II
Champion II

Here is a solution:

0683p000009Lrni.png

And the result:

Starting job test at 15:33 14/11/2017.

[statistics] connecting to socket on port 4011
[statistics] connected
.-----------+-----+-----+----.
|         tLogRow_13         |
|=----------+-----+-----+---=|
|col1       |col2 |col3 |col4|
|=----------+-----+-----+---=|
|CAID:A70-01|M-001|35/MA|90  |
|CAID:A70-01|M-001|37/MA|51  |
'-----------+-----+-----+----'

[statistics] disconnected
Job test ended at 15:33 14/11/2017. [exit code=0]
Anonymous
Not applicable
Author

Thank you so much @TRF,

 

Let me check this code and will update you the same.

 

Thanks

Shree