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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Finding particular data in output

Input:

DTP*007*RD8*20120101_20131123

GF*2700

8E*850*1213001

GF*1*1213

TEA*1*0022z553

 

Output:

007

2700

850

1

1

 

Please help me to find this

Labels (2)
3 Replies
TRF
Champion II
Champion II

Forget ths post.

Anonymous
Not applicable
Author

Hello,

 

You can create a routine and call it in the Tmap.

In the routine, you can split on the character '*' (if it's the separator in your input) and use the method "isNumber" from the Java class NumberUtils.

 

I hope this answer will help you.

 

TD

Anonymous
Not applicable
Author

This Java method will work for this. Copy and paste this into a new (or existing) routine and use it as I will demonstrate below....

 

    public static String getSection(String data, String separatorRegex, int position){
    	String returnVal = null;
    	
    	if(data!=null){
    		String[] values = data.split(separatorRegex);
    		
    		if(values!=null && values.length>=position){
    			returnVal = values[position-1];
    		}
    	}
    	return returnVal;
    }

Lets say your routine is called "MyRoutine", your row is called "row1" and your column holding the string is called "input", for your data you would use this method like below...

routines.MyRoutine.getSection(row1.input, "\\*", 2)