Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subfield within subfield not working

I have a string which is like

1.1 deposits

when I use the below code

SubField((SubField([Line Description],' ', 1)), '.', 1) as LEVEL1

the output of 1.1 deposits should be 1. However, it is not working. How do I make this work? thanks

8 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You dont need 1 Deposits ..?

Please explain the logic in details.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
surendraj
Specialist
Specialist

From the above what is your expected output?

Not applicable
Author

Basically I would like to just extract the first digit before the first decimal point. So if the string is "5.6 Assets", I would like the value 5. If the string is "12.44.7 Liability", I would want 12.

Not applicable
Author

I have a string which is like

1.1 deposits

2.1 assets

55.1 liability

my expected output will be

1

2

55

surendraj
Specialist
Specialist

Why can't  you simply try with..

SubField('12.44.7 Liability','.', 1)

surendraj
Specialist
Specialist

Try with..

SubField([Field name],'.', 1)

Peter_Cammaert
Partner - Champion III
Partner - Champion III

AFAIK your original code works like a charm. Are you sure about the actual content of field [Line Description] ?

Subfield within Subfield not working thread249588.jpg

Note: to make sure that I use the same code as you did, I copy/pasted your script line into the editor.

Of course, surendra j already posted a shorter version that produces the same output.

surendraj
Specialist
Specialist

Please Close the thread..if you got the relevant one..

It will be useful to community members.