cancel
Showing results for 
Search instead for 
Did you mean: 

udf query

Former Member
0 Kudos

Hi java gurus,

i hv a small requirement,

I need to put last column(delperiod.substring(0,4)+"01") at 173-183 locations.

Now, with the below code, it is just attaching at the end of row(124-130).

result.addValue(  contractNo + tmpqtystr1 +  price +  delperiod.substring(0,4)+"01" +  condate +  shipwts +  mtype +  cif +  comtype +  rejreason 
+  type +   usrname +impdate +  imptime + delperiod.substring(0,4)+"01" );

pls help me with java code.....

santosh.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Santosh,

if you need the content : delperiod.substring(0,4)+"01") at 173-183 position, you need to make sure that the preceding content of it should be ending at 172nd position.

You can get it by using the following code.

String Output="";

String temp=contractNo + tmpqtystr1 + price + delperiod.substring(0,4)+"01" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime;

int strlen= temp.length();

for int(i=strlen;i<173;i++)

{

Output=Output.concat(" ");

}

Output=Output.concat(delperiod.substring(0,4)+"01");

result.addValue(Output);

Answers (1)

Answers (1)

former_member204873
Contributor
0 Kudos

Location of delperiod.substring(0,4)+"01") will depend on length of other varaibles used in the code such as contractNo + tmpqtystr1 + price,

also length of delperiod.substring(0,4) will be 5 and length of "01" will be 2, it total it is 7, but you want it at location 173-183 for which length is 11.

so what is the logic of the length you want to use.