cancel
Showing results for 
Search instead for 
Did you mean: 

SP 22 formula issue when export to Excel

mikael_kratz
Explorer
0 Kudos

Hi

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.SetDataSource(dwGaugeView)

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?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

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

Answers (2)

Answers (2)

mikael_kratz
Explorer
0 Kudos

Hi

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

Mikael.

DellSC
Active Contributor
0 Kudos

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.

-Dell