Crystal 报告将值转换为带符号的数字
Crystal Report converting value to number with symbol
我创建的 Crystal 报告有问题。我正在使用数据库中的字段,并在分析字段等于特定值的情况下提取结果值。
在条件中,第一个检查查看分析字段并检查它是否等于 "Conf"。结果是“<10”
第二个检查查看分析字段并检查它是否等于 "Original"。结果是“20”。
我希望结果按上面的顺序显示,但是使用以下基本逻辑它 returns 20 的结果。
if analysis = "conf" then result
else if analysis = "Original" then result
我在处理多个记录时遇到了这个问题,但是通过将两个结果都转换为数字 (toNumber(Result)) 解决了这个问题。但是,此记录的字段值中包含小于符号,这会导致 conf 结果为 "be skipped" 并将显示原始结果。我尝试了一些没有成功的事情。这是我在下面的位置的代码。我觉得这是复杂逻辑的方式,但我只是添加了它,因为我有想法并且它显示了我已经尝试过的东西。
if {UNITS} = "CFU_G" then
if {ANALYSIS} = "CONF" and
{RESULT}="" or
{RESULT} = "0" then 0
else if {ANALYSIS} = "CONF"
then if isNumeric({RESULT}) then
tonumber({RESULT}) else
tonumber(Replace ({RESULT}, "<", ""))
else
if {UNITS} = "CFU_G" then
if {ANALYSIS} = "Original" and
{RESULT}="" or
{RESULT} = "0" then 0
else if {ANALYSIS} = "Original"
then if isNumeric({RESULT}) then
tonumber({RESULT}) else
tonumber(Replace ({RESULT}, "<", ""))
谢谢,
汤姆
这是我想出的解决方案。
Field 1
whileprintingrecords;
stringvar vResult := "";
Field 2
whileprintingrecords;
stringvar vResult;
vResult := if {RESULT.UNITS} = "CFU_G"
and {RESULT.ANALYSIS} = "CRA_LIS_ENU_CONF_MPCRAM29"
then {RESULT.FORMATTED_ENTRY}
else if {RESULT.ANALYSIS} = "CRA_LIST_ENU_MPCRAM29"
and {RESULT.UNITS} = "CFU_G"
and vResult = ""
then {RESULT.FORMATTED_ENTRY}
Field 3
whileprintingrecords;
stringvar vResult;
vResult;
我创建的 Crystal 报告有问题。我正在使用数据库中的字段,并在分析字段等于特定值的情况下提取结果值。 在条件中,第一个检查查看分析字段并检查它是否等于 "Conf"。结果是“<10” 第二个检查查看分析字段并检查它是否等于 "Original"。结果是“20”。
我希望结果按上面的顺序显示,但是使用以下基本逻辑它 returns 20 的结果。
if analysis = "conf" then result
else if analysis = "Original" then result
我在处理多个记录时遇到了这个问题,但是通过将两个结果都转换为数字 (toNumber(Result)) 解决了这个问题。但是,此记录的字段值中包含小于符号,这会导致 conf 结果为 "be skipped" 并将显示原始结果。我尝试了一些没有成功的事情。这是我在下面的位置的代码。我觉得这是复杂逻辑的方式,但我只是添加了它,因为我有想法并且它显示了我已经尝试过的东西。
if {UNITS} = "CFU_G" then
if {ANALYSIS} = "CONF" and
{RESULT}="" or
{RESULT} = "0" then 0
else if {ANALYSIS} = "CONF"
then if isNumeric({RESULT}) then
tonumber({RESULT}) else
tonumber(Replace ({RESULT}, "<", ""))
else
if {UNITS} = "CFU_G" then
if {ANALYSIS} = "Original" and
{RESULT}="" or
{RESULT} = "0" then 0
else if {ANALYSIS} = "Original"
then if isNumeric({RESULT}) then
tonumber({RESULT}) else
tonumber(Replace ({RESULT}, "<", ""))
谢谢, 汤姆
这是我想出的解决方案。
Field 1
whileprintingrecords;
stringvar vResult := "";
Field 2
whileprintingrecords;
stringvar vResult;
vResult := if {RESULT.UNITS} = "CFU_G"
and {RESULT.ANALYSIS} = "CRA_LIS_ENU_CONF_MPCRAM29"
then {RESULT.FORMATTED_ENTRY}
else if {RESULT.ANALYSIS} = "CRA_LIST_ENU_MPCRAM29"
and {RESULT.UNITS} = "CFU_G"
and vResult = ""
then {RESULT.FORMATTED_ENTRY}
Field 3
whileprintingrecords;
stringvar vResult;
vResult;