4/21/2021 0 Comments Delphi Chart With 2 Decimal Places
I need to display the numbers (often entered as 00.00000 ) with two decimal places while displaying any text in the field as text.I used an IIF statement to format the field but it either displays D, 00.00,., or error in the fields.
Here are examples of my attempts: IIF(Fields.MyField.ValueNumber, Format(FieldsMyValue.Value, D, cstr(FieldsMyValue.Value)) This displayed Ds in the field when I attempted to format the field as a Decimal. Using a lower case d did not work. IIF(Fields.MyField.ValueNumber, Format(FieldsMyValue.Value, 00.00, cstr(FieldsMyValue.Value)) This displayed 00.00. Removing the double quotes displayed zeros instead of the actual string values. How can I get numbers that are in this nvarchar field to display with two decimal placed while also displaying actual text as text This should be very simple to do What I have tried: My attempts are described in my question. I am almost there, though - this works for the number formatting but is displaying Error for the string text or blank: IIF(FieldsMyValue.ValueNumber, Format(CDbl(FieldsMyValue.Value),00.00), FieldsMyValue.Value) If I can just resolve the Error that displays in the last part of m condition, I may finally have this resolved. Basically, trying to take on two types when it can only have one. If you convert your text to a double, add turn it to money, then convert back to text, that would work Basically same idea in the query i posted. Thats what you need to do here, I think you converted the CDbl back to text it would not print Error in situations where your value is not a number. If its, you need to format it: IIF(IsNumeric(MyField), Format(MyField, 0.00), MyField) For further details, please see: Expression Examples (Report Builder and SSRS) IsNumeric Function (Visual Basic).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |