cancel
Showing results for 
Search instead for 
Did you mean: 

Take last three numbers and use that as the item number.

former_member350687
Participant
0 Kudos

Hi Experts,

Could you please help me achieving in below logic.

Take last three numbers and use that as the item number. 

Ex 1: If last three begin with zero, I.e., 050, then just make 50 the item number.

Ex 2: 11th item would be number 110 since last three characters would be 110

0101 = 010

0201 = 020

0301 = 030

Thanks,

MR

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member350687
Participant
0 Kudos

Hi All,

Thanks for quick reply I am trying the above suggestions.

Will get you back once done.

Thanks,

MR

ealimeta
Participant
0 Kudos

HELLO .

Suppose you have    0010      first item no   and    0150 second item no  .

        Data  :  item_no(4) ,
                    swat(3) .
    

           item_no = 0010.

         if item_no+1(1) = '0'  .

          swap = item_no+2(2) .
         else .
          swap = item_no+1(3) .
         endif.

   After the if condition you will have   your  correct item number into the swap variable length 3 characters .


     

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Mahi,

Can you pls try with the below udf and check the outcome.

Code snippet:

String result="";

if(input.length()<3)

      result=input;

else

{

    int st = input.length()-3;

   result = String.valueOf(Integer.parseInt(input.substring(st)));

}

return result;

Former Member
0 Kudos

Hello ,

Can you pls explain your requirement in more detail?

If you want 0101 = 010 then try below logic with Substring node function.

Thanks

vinaymittal
Contributor
0 Kudos

take a substring from length -3 to length and then apply abs function on it