Skip to Content

SP 22 formula issue when export to Excel

Jan 12 at 12:56 PM


avatar image


After updating to SP22, formulas not working for excel export anymore.

I have a report that loads without viewer and print data to an excel file (Just data in xlsx). I have one "Show String" formula on a field.

The simple code i use:

Dim crReportDocument As New crExportToExcel

crReportDocument.ExportToDisk(ExportFormatType.ExcelWorkbook, SaveFileDialog1.FileName)

And the formula for the Textfield StatusID:

if {Gauges.StatusID} = "-6" then

Formula = "Calibrate"

end if

This formula has worked fine until SP22. The field does not format the string. And the result is now "-6" in the excel file.

I have tried to make a new report, typed the formula in VB and Crystal. Tried to save the file in both xlsx and XLs, but the result is the same, no string formatting

Can I do it in any other way to get export to print the correct string value?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Don Williams
Mar 19 at 03:04 PM

What DB driver are you using, ODBC or OLE dB? Try the other one, could be the Client is now converting the field type.

10 |10000 characters needed characters left characters exceeded
Dell Stinnett-Christy Jan 12 at 03:38 PM

In Design mode, look at where the "-6" is showing up on the report. Is the object on the report the field or the formula?

Is {Guages.StatusID} as string field or a number field in the database? If it's a number, try comparing it to -6 without the quotes.


10 |10000 characters needed characters left characters exceeded
Mikael Kratz Jan 15 at 09:39 AM


Thanks for your answer!

The object is an ordinary field that i draged from the field Explorer and then format in the "FormatEditor". I click the "Show String" button and write the formula. The databasefield is string so the "-6" is text not a number. I succeded with an ugly workaround, i use a table and copys my data to it and formats the field in that way and use the table as datasource . But thats not the way i want to do it especially when it has been working for the last 2 years. :(


10 |10000 characters needed characters left characters exceeded