Five Stars

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

3 REPLIES
Twelve Stars TRF
Twelve Stars

Re: Finding particular data in output

Forget ths post.


TRF
Five Stars tdz
Five Stars

Re: Finding particular data in output

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

Twelve Stars

Re: Finding particular data in output

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) 
Rilhia Solutions