Base Reports Conditional Print Expression Debugging

I’ve been working through the BG7.3 Base Guide and on page 69 the conditional print expression is returning nothing. Is there a way of debugging this to find out what is going wrong?

This code =IF([gender]="m";"Male";"Female") ?

Is the a field “gender” in datasource?

Could you show a screenshot of the field with this content, together with properties of the field on the right?

I find this a lot easier to do in a query.

SELECT *, CASE WHEN "gender"='m' THEN 'Male' ELSE 'Female' END AS "Sex"
FROM "Table"

selects all columns ( * ) from “Table” plus another one labeled “Sex” (semantically overriding “gender” with the real thing).
Link your report to that query instead of the table.

I’d like to be able to understand why the code is not working and how to debug it.

Start a new query in SQL mode.
Paste the query and replace “Table” with the name of your actual table.
Hit F5 to run the query.
What is the exact error message?
What kind of database are we talking about? See status bar of your Base window.

http://catb.org/esr/faqs/smart-questions.html

The query runs fine - its the Conditional Print Expression that is failing.

@madtom1999 : Have a look at the code. If it isn’t a cursor inside the field it will end with / . Feel free to upload the example database to see what is going wrong.

@Villeroy : The example should show how to get the result with ReportBuilder, not with a query. It should be an example for using formular in a report. It is the first example shown in the Base Guide, see BG 7.3, p. 69.

Beispiel_Sport.odb (33.6 KB)
Original database from German Base Handbuch

I compared mine to the example DB version and could find no reason for
the thing to fail, I deleted the report and have built it again and it
functions as it should. Does Base list errors somewhere?

There will be only error-messages in Base (forms, queries and tables), but nothing except when reports won’t run at all. So you will often get this behavior you described: Field is empty, no error appears, but you don’t know why …

Remember: The ReportDesigner has been created before LO exists. There hasn’t been changed much since over 10 years.

That’s a bit of an Achiles heel!

Indeed! Developers needed. ReportDesigner is a little bit tricky, because it has been written in Java and all other LO is written in C++.

t78971.odb (8.2 KB)

1 Like

Yes, this shows how it should work!