简体   繁体   English

公式字段未在Crystal Report 8.5中显示

[英]Formula field not showing in crystal report 8.5

I'm using an old version of crystal reports 8.5 and I'm having problems in showing a field in the details. 我使用的是旧版本的Crystal Report 8.5,但在显示详细信息中的字段时遇到问题。

This report uses 6 tables in SQL Server database:  
2 in database1:
tblRecibo, tblCanaisDistribuicao

3 in database2: 
tblPessoas, tblMoradas, tblCodPostal, tblRamos

tblRamos.CodRamo is an int datatype and I want to display it in the details section. tblRamos.CodRamo是一个int数据类型,我想在详细信息部分中显示它。

@N_Apolice @N_Apolice

left(CSTR({tblRamos.CodRamo}, "000"),3)

It seems that I am not able to get any field from this table, yet I can access fields from other tables of the same database in the Group-Header section (This report uses tables from 2 different databases, and none of the table names used is repeated on both databases). 看来我无法从该表中获取任何字段,但是我可以在“组头”部分中访问同一数据库的其他表中的字段(此报告使用来自2个不同数据库的表,而没有使用任何表名在两个数据库上重复)。

Already pressed the verify database button a few times... but the problem persists... is there a way to force it to check this table in particular? 已经多次按下了“验证数据库”按钮...但是问题仍然存在...是否有办法强制其特别检查该表? or this database in particular?(since there are 2 and it might be only checking the other one) 还是这个数据库?(因为有2个,可能只检查另一个数据库)

I have tested in SQL, if the query to get the data should return fields, and it does... 我已经在SQL中进行了测试,如果获取数据的查询应该返回字段,并且确实如此...

edit 编辑
I started to redo the whole report, and apparently that formula field is does not display its value correctly only if I add code to another formula fields (fields that use the same database but other data tables) 我开始重做整个报告,很明显,仅当我将代码添加到另一个公式字段(使用相同数据库但使用其他数据表的字段)时,公式字段才正确显示其值。

@Nome @Nome

Ucase({tblPessoas.Nome} & " " & {tblPessoas.NomeIntermedio} & " " & {tblPessoas.Apelido})

@Morada @Morada

Ucase({tblMoradas.Morada})

@CPostal @CPostal

IF ISNULL({tblMoradas.LocPostal}) THEN
{tblMoradas.CPostal} & "-" & {tblMoradas.CPostalAux}
ELSE
{tblMoradas.CPostal} & "-" & {tblMoradas.CPostalAux} & " " & {tblMoradas.LocPostal}

In my mind this makes no sense at all... 在我看来,这根本没有道理。

edit2 EDIT2
these 3 fields are in the Group Header section while the other one is in the details section... can that be the problem? 这三个字段位于“组标题”部分,而另一个字段位于“详细信息”部分...这可能是问题吗?

栏目

报告

The fields that are in conflict for some reason are @N_Apolice (in the details) and @Nome, @Morada, @CPostal on the header. 由于某些原因发生冲突的字段是@N_Apolice(详细信息)和标头上的@ Nome,@ Morada,@ CPostal。

All the other fields in the details section come from another data source and work well 详细信息部分中的所有其他字段都来自另一个数据源,并且运行良好

在此处输入图片说明

I can write as comment but its is becoming huge and wrote as answer

Brother I can see it as a clear linking issue with your tables... 兄弟,我可以将其视为与您的表的明确链接问题...

check the linking between the tables tblPessoas, tblMoradas, tblCodPostal and tblRamos ... because your formula Morada and CPostal are coming from table tblMoradas and Nome is coming from table tblPessoas and finally problamatic field N_Apolice is coming from tblRamos which all belongs to same datasource.... 检查表tblPessoas, tblMoradas, tblCodPostaltblRamos之间的链接...因为您的公式Morada and CPostal来自表tblMoradasNome来自表tblPessoas ,最后问题域N_Apolice来自tblRamos ,它们都属于同一数据源。 ...

Now the main problem is when 3 formulas are added then one that is in detail is not displaying... which I think is because of linking becuase when you include the fields from other tables other than tblRamos then the linking from those tables will be included in query which is preventing data from tblRamos not displaing in reports..... 现在的主要问题是,当添加3个公式时,没有显示详细的公式...我认为这是由于链接的缘故,因为当您包含tblRamos以外的其他表的字段时,将包括这些表的链接在查询中,这将阻止tblRamos数据不在报表中移位.....

Now when 3 formulas are deleted and field from tblRamos is included then those 3 tables are not included in query that is the reason you can see some data... 现在,当删除3个公式并包含tblRamos中的字段时,查询中不包含这3个表,这就是您可以看到一些数据的原因...

You can try your self by checking query with including 3 tables first and removing those tables again. 您可以尝试检查自己的查询,首先检查包含3个表的查询,然后再次删除这些表。 If you are still not sure then fire same queries on datbase and check the rows extracted.. 如果仍然不确定,请在datbase上触发相同的查询,并检查提取的行。

Solution: 解:

The solution I suggest is to check the linking first and if there is any inner join to the tblRamos from other tables then remove that and include outer join to table tblRamos and check the result and according to me that should work. 我建议的解决方案是首先检查链接,如果从其他表到tblRamos的是内部联接,然后删除该联接,并包括对表tblRamos的外部联接,并检查结果,并且对我来说应该可行。 It its working then check indetail database linking and data you want to display. 它可以正常工作,然后检查详细的数据库链接和要显示的数据。 To my knowlege this should work. 据我所知这应该工作。

Let me know if my approach worked for you. 让我知道我的方法是否对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM