cancel
Showing results for 
Search instead for 
Did you mean: 

Append The 0000 to Sales order number

Former Member
0 Kudos

Hi Experts,

suppose its 10 digit sales order .E.g 0000013225

I need to enter only 13225 so how i will append 00000 in above case. Numbers of 0 also varies.e.g 0000121135

Thanks

Nityanand Arya

View Entire Topic
chander_kararia4
Contributor
0 Kudos

Hi

Its a total programming logic. Here is the logic:-

ex.

If your sales order is of 10 digits (mandatory), say 0000012345, then

- In your input field, you enter only 12345

- Now count the number of characters in the above string, in above case it is 5.

- So, to make it a 10 digit number, you need to append 5 Zeros,

It will look like this....

String orderNum = wdContext.current........getX();

int count = orderNum.length();

if(count==5)

{

//Append 5 leading zeros.

orderNum = "00000"+orderNum;

}

like this way, you can solve your issue.

Best Regards

Chander Kararia

Edited by: Chander Kararia on Sep 29, 2009 11:32 AM

Former Member
0 Kudos

Thanks a lot ,

But where to add the code or shall i create one java file and add it there.I am bit new to this framework.

chander_kararia4
Contributor
0 Kudos

Hi Nitya,

This is also very simple.

- No need to create any Java file for this code.

- In your view, You are taking Input(Order Number) from the User. After that, You must be having something like,

  • Submit Button Click, OR

  • Link Action, etc.

  1. In short, there must be an Action on that page where you will be doing some processing on the Order Number.

- In the same method, where you are Getting the Order Number, just write the logic below that.

#Important Note -> In case you are using this modified order number many places, make sure you do either of the following steps to get the correct value every-time.

1. After setting the value to 10 digits, set the value in Context. OR

2. Create a Global variable (define it in 'Other' section, you may see it at the end of implementation tab, just scroll down) and set it only once the value.

NO NEED TO REPEAT THE CODE IN EACH & EVERY METHOD.

This will solve your issue. Still problem? Please let me know your application functionality.

Thanks.

Best Regards

Chander Kararia

Edited by: Chander Kararia on Sep 29, 2009 1:50 PM