在水晶报表中设置报表字段值

时间:2022-07-21 16:37:01

I have a report field where its value is "2". I need to display in report as "True" if report field value is 2.How do i do this in Formula editor crystal reports ? Please help me.

我有一个报告字段,其值为“2”。如果报告字段值为2,我需要在报告中显示为“True”。如何在公式编辑器水晶报告中执行此操作?请帮我。

EDIT :Here is my code in formual Editor: if( {emp.company_id}=2) Then CStr ({emp.company_id}) ="ABC pvt ltd"

编辑:这是我在表格编辑器中的代码:if({emp.company_id} = 2)然后CStr({emp.company_id})=“ABC pvt ltd”

As emp.company_id is integer value i have tried converting it to string but still it displays as 2 in report.

由于emp.company_id是整数值,我尝试将其转换为字符串但仍然在报告中显示为2。

2 个解决方案

#1


All you need in the formula is

公式中你需要的只是

{Tablename.Fieldname}=2

#2


What I don't know is what you want to display if it isn't 2. Assuming you want to display the original value then you need to add a formula to your report, as follows:

我不知道的是,如果不是2,您想要显示的内容。假设您要显示原始值,则需要在报表中添加公式,如下所示:

if ({emp.company_id}=2) then "true"
else cstr({emp.company_id})

#1


All you need in the formula is

公式中你需要的只是

{Tablename.Fieldname}=2

#2


What I don't know is what you want to display if it isn't 2. Assuming you want to display the original value then you need to add a formula to your report, as follows:

我不知道的是,如果不是2,您想要显示的内容。假设您要显示原始值,则需要在报表中添加公式,如下所示:

if ({emp.company_id}=2) then "true"
else cstr({emp.company_id})