on 12-06-2005 7:45 PM
I am dividing my Premium by 100 and then sending to the targetamt.
Premium is of type intege. 100 is constant and Targetamt is string.
The problem
-
Premium is 10000 then I am expecting Targetamt as 100.00, but what I am getting is 100.
On the other hand
if Premium is 10035 then I am getting the correct value 100.35.
I have tried changing the Premium data type to Float, Decimal, but every time for the whole numbers the Decimal portion is getting cut.
Any Suggestions please
Hi,
you have to do it insid ea user advanced function
(inside graphical mapping for example)
change the strig into an integer
divide it and change it back to string
BTW
string to int:
someint = Integer.parseInt(somestring);
int/double to string:
somestring = String.valueof(someinteger);
Regards,
michal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try this:
create a simpl function with one parameter
double resultset;
int newint = Integer.parseInt(a);
int dividbythis = 100;
resultset = newint/dividbythis;
NumberFormat formatter = new DecimalFormat(".00");
String myvalue = formatter.format(resultset);
String finalvalue = String.valueOf(myvalue);
return finalvalue;
BTW
add
java.text.DecimalFormat;
and java.text.NumberFormat;
to your simple function
Regards,
michal
Message was edited by: Michal Krawczyk
Thanks Mich. It worked out. wonderful and thanks again.
-
Imports: java.text.DecimalFormat;java.text.NumberFormat;
public String Divide(String a,Container container){
double resultset;
int newint = Integer.parseInt(a);
int dividbythis = 100;
resultset = newint/dividbythis;
NumberFormat formatter = new DecimalFormat(".00");
String myvalue = formatter.format(resultset);
String finalvalue = String.valueOf(myvalue);
return finalvalue;
}
-
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.