0
votes

I am currently designing a report in crystal reports. In the header I have the standard fields like Date/Time and a bunch of variables. In some cases one of the variables does not resolve to anything (it is empty). When that variable is empty all the report data disappears.

I tried tricking Crystal Reports with creating a formular field, but again no luck!

Any ideas?

All data is received from a MySQL database and the field that causes the trouble is based on a custom query (command).

The actual query:

SELECT `teacher_name` 
FROM `class_schedule` 
LEFT JOIN (`teacher`, `cs_class`) 
ON (`class_schedule`.`class_supporter`=`teacher`.`teacher_id` AND
    `cs_class`.`cs_id`=`class_schedule`.`cs_id`)
WHERE `class_id`={?classId}
1
You have some selection criteria on that variable probably. Note that field value can be "null" sometimes - this need different processing than "" (empty). - Arvo
I already checked that. The whole query is not even linked to any of the other data :( - Ben
@Ben: How does this variable get set? It may be that whatever is causing it to be set as empty is also causing the report to return no data. - user359040
@Ben Please show us the query. - RKh
I posted the query above. I have quite a lot of confidence in my SQL queries, but I'm just not sure how CR is evaluating it in regards with the report. Running the query alone gives the correct result... - Ben

1 Answers

0
votes

I have not worked with MySQL much at all. That said, I have never seen that construct for LOJs, so I am questioning the format. Pardon my ignorance if I am uninformed.

If you have CR Developer available, it might be interesting to see what query CR comes up with, and I guess a trace will show what is actually submitted to MySQL.

SELECT `teacher_name` 
FROM `class_schedule` cs
  LEFT outer JOIN `teacher` tch
    on `cs`.`class_supporter`=`tch`.`teacher_id` 
  Left outer join `cs_class` csc
    on `csc`.`cs_id`=`cs`.`cs_id`
WHERE `class_id`={?classId}

is the best I can recommend trying.