Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: Number Display form problem?  (Read 2366 times)

showmesky

  • Newbie
  • *
  • Posts: 6
    • View Profile
Number Display form problem?
« on: August 30, 2021, 02:49:29 pm »
Hi, I have a problem about display form. :)

I want to display the number like this:

value1=234567.0

if in QT, I will use the function to finish it

QString::number(value1,'e',4);

the result is 2.3457e+05(scientific notation)!!!!

in limereport version 1.4.7, I get the right result with numberformat, but I get a different result in new version (1.5.0)

numberformat($D{all.3},"E",5,"en-En")

can anyone help me? thanks

showmesky

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Number Display form problem?
« Reply #1 on: August 31, 2021, 10:47:36 am »
ok,I have to create wheels for my self.

for achieving the function ,I use the script to finish it(different from old version too),anyone can give me a introduction ?

Code: [Select]
function Pow(base,exp){


if(exp == 0){

return 1;
}else{

var result = 1;
for(i=0;i<exp;i++){

result=result*10;

}
return result;
}


}

function dig_jud(value){

if(value<10&&value>=0){
return true;
}

if(value>=10){
return false;
}

}

function sc_nota(value,percision){

// to make scientific notation
var result;
var digit;
var count=0;
result = value;
var srs;
if(value>=1){


while(result>1)
{
result=result/10;
count++;
}
var exp=count-1;
var temp = Pow(10,exp);
result = value/temp;
digit = count-1;
if(dig_jud(digit)){
srs = numberFormat(result,'f',percision)+"E+0"+digit;

}else{


srs = numberFormat(result,'f',percision)+"E+"+digit;
}
 
return srs;

}
if(value<1&&value>0){

while(result<1){

result=result*10;
count++;

}
digit=count;
var temp1 = Pow(10, count);
result = value*temp1
if(dig_jud(digit)){
srs = numberFormat(result,'f',percision)+"E-0"+digit;

}else{


srs = numberFormat(result,'f',percision)+"E-"+digit;
}
return srs;

}

if(value<0){

return "NULL"

}
}

seems work fine