简体   繁体   中英

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.

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.

@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).

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)

I have tested in SQL, if the query to get the data should return fields, and it does...

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

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

@Morada

Ucase({tblMoradas.Morada})

@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
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.

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....

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.....

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...

You can try your self by checking query with including 3 tables first and removing those tables again. If you are still not sure then fire same queries on datbase and check the rows extracted..

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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