Conditional print expression getting cut in half

I’m trying to use the following conditional print expression on a text box in a group footer in a report

In the General tab of the text box, I click the “…” button and in the Function Wizard I type =SUM(IF([Class]=’%Course%’;[Total Fee];0))

When I click ok I can see the Conditional Print Expression field now says “SUM(IF([Class]=”

If I click the “…” again to open the Function Wizard, my original text is gone and is now just “SUM(IF([Class]=”

Is this a bug or a syntax issue? I receive no errors when inputting the expression or when clicking ok, so it feels like a bug.

Is anyone else having issues with Conditional Print Expressions?

Using LibreOffice 24.2 (Firebird Embedded)

@ZaneZorro : Better you upload an example.
Conditional print will work like [Fieldname]="true" OR [Fieldname]=10 or something like that. It will show the content of the field or it won’t show, but it will never show different content depending on a function.
Try your code with a function in tab “Data”, not tab “General” of the properties of text field.

Thank you Robert, I just tried that but it did the same thing in the data tab, it cut the expression to just “SUM(IF([Class]=”

I tried removing the quotation marks and put “SUM(IF([Class]=%Course%;[Total Fee];0))” which it accepted, but nothing is appearing in the box on report generation. The idea is to check the string value in [Class] for the text “Course” and if it contains it, then to take the value in [Total Fee] else a zero value

Please have a look at the Base Guide:
You could get a part of text content with FIND. Might be you could get better results with
IF(FIND("Course";[Class]);[Total Fee];0)
but: Functions in ReportBuilder will work with much trial and error. I would prefer to get all my content for the report from the view I created for the report.
With SQL
LOCATE('Course' IN "Class")
will give the position of ‘Course’. If position is > 0 then you need “Total Fee”:
CASE WHEN LOCATE('Course' IN "Class") > 0 THEN "Total Fee" ELSE 0 END
Now you could get the SUM with your database in SQL, not with a function inside ReportBuilder, which will only slow down executing in ReportBuilder. Let it do through the database. It will be much faster.

1 Like

Thank you Robert, yes creating a view with this seems to be the only way to get it to work. LOCATE didn’t work but I did get it to work like this

CASE WHEN “Class” LIKE ‘%Course%’ THEN “Total Fee” ELSE 0 END AS “Course Payments”

1 Like