cancel
Showing results for 
Search instead for 
Did you mean: 

Quantity

praveenreddy_bk
Participant
0 Kudos

Hi,

A quantity of five items will appear as 5.0 for example. . So we need to pass 5 in the target.

Validations:

We can not have quantity in decimals (e.g. 5.1,1.3,23.5,1111.6 0.5 etc)

Quantity can not be non numeric or blank.

Thanks in Advance.

I need UDF or v can do in Graphical Mapping

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

u can acheive this by using standard function FormatNum and specify the format as ### which indicates numeric

Rajesh

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Praveen,

If you want 5.1 to be 5, and 5.5 to be 5 and 5.6 to be 6 then you can use standard function ceil and floor.

But if you want 5.1, 5.5 and 5.6 then you need to use a UDF. So you need to get the value what ever is there before the . symbol.

Create a Value user defined function and name it as GetValue. Take one argument as a.

int i = a.indexOf(".");

a = a.substring(0,i);

return(a);

Regards,

---Satish

Former Member
0 Kudos

use floor function under Arithmetic Functions...

praveenreddy_bk
Participant
0 Kudos

Hi

validations also required .

Floor function is not giving exact number .

Thanks

Former Member
0 Kudos

if(qty!=null)

quantity = (integer)qty

write UDF thats it simple...

Rajesh

Former Member
0 Kudos

Step1 )

use below code to check if the data eneterd is Numeric..

for (int i = 0; i < str.length(); i++) {

//If we find a non-digit character we return false.

if (!Character.isDigit(str.charAt(i)))

return false;

}

return true;

Step 2)

if it is numeric, then use the Floor function to give you the non-Decimal value; and it does work n gives the correct number..

example ;

for 5.1 it gives 5

for 1.3 it gives 1

for 23.5 it gives 23 etc...

Step 3)

to check if the numebr is null; in graphical mapping use constant(with null) compare witrh data using Equals and then use Boolean funtion if then