最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

crystal reports - Convert scientific notation to number to do math - Stack Overflow

programmeradmin0浏览0评论

My Crystal Reports experience is limited. Once we have reports in place, years may pass before modification is required and have to delve back in to CR. Presently, I have two fields in database that I need to covert to numbers to divide one by the other. Example of Field1 is '0.00000850 V'; example of Field2 is '9.5e-007 V'. How do you go about converting these to numbers in order to do the math.

Have not been able to solve

My Crystal Reports experience is limited. Once we have reports in place, years may pass before modification is required and have to delve back in to CR. Presently, I have two fields in database that I need to covert to numbers to divide one by the other. Example of Field1 is '0.00000850 V'; example of Field2 is '9.5e-007 V'. How do you go about converting these to numbers in order to do the math.

Have not been able to solve

Share Improve this question asked Feb 3 at 11:23 JayePJayeP 11 1
  • 1 No idea, because this string do not represent a valid number, they have a " V" at the end that makes them invalid representation of numbers. Ask whoever created those fields what does the V mean. – Cincinnatus Commented Feb 3 at 11:48
Add a comment  | 

1 Answer 1

Reset to default 0

Assuming the " V" at the end is always there, we can simply remove the last 2 characters. So use something like this:

local stringvar SciNum := Left({SciNum_Raw}, Len({SciNum_Raw}) -2);

local stringvar array SciNum_Array := Split(SciNum, "e");

IF (UBound(SciNum_Array) = 2) Then cDbl(SciNum_Array[1]) * 10^cDbl(SciNum_Array[2])
ELSE 0; 
发布评论

评论列表(0)

  1. 暂无评论