Expression null-value as empty string

edited 8:17PM in FastReport .NET
I try to print the result of a expression as empty string if one value is 0 or null. How can I do it? See attached test.

Comments

  • edited 8:17PM
    Hello,

    The correct expression is:

    Report.I3] == 0 ? -1 : [Report.I2]/[Report.I3

    Even if you set ConvertNulls to false, the conversion is always performed in an expression. To check for null or DBNull, you need to use the following method:

    Report.GetColumnValueNullable("Report.I3") == null || Report.GetColumnValueNullable("Report.I3") == DBNull.Value
  • edited 8:17PM
    Hello,
    thanks, I'm understand. But my my question was, how can I return a DBNull-Value or a empty string (not -1 as in my Test) if the result of the expression is not defined so that my appended test works?
  • edited 8:17PM
    [[Report.I3] == 0 ? null : (object)([Report.I2]/[Report.I3])]

    I've converted the result to (object) to make "?" operator working.
  • edited 8:17PM
    Thanks much!

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.