Inline formatting in an RDL Report

Posted by: greg on 24 July 2022, 3:49 pm EST

    • Post Options:
    • Link

    Posted 24 July 2022, 3:49 pm EST

    We’re trying to port a SSRS report to ActiveReports v16.

    In our report, it is common to want to display a numeric field formatted as a currency. If the field is standalone, we can just set the Format property of the TextBox to the built-in currency format string.

    However, generally we want the displayed currency amount to have text following it. The text should follow immediately after the currency amount, and the currency amount could be varying length depending on the value, so we are using a single TextBox with the field value and the following text concatenated.

    =Fields!FeeAmount.Value & " per payment"
    

    In SSRS we utilised the Placeholder functionality which allowed setting formatting on fields embedded within a Textbox.

    We are not sure how to achieve a similar output in ActiveReports. I was expecting to be able to call a function to format the field value as a string, but there doesn’t appear to be any built-in string formatting functions.

    Any suggestions on how to achieve inline formatting of field values?

  • Posted 26 July 2022, 1:27 am EST

    Hi Greg,

    If you want to inline format Text/Fields. Then you would have to use the Formatted Text Control. The Formatted Text control can perform mail merge operations, plus it displays richly formatted text in HTML.

    You can add formatting to your field which would be separate to what it would be in the text you are adding after the FeeAmount value.

    For more information on Formatted Text please use the following page of our documentation:

    https://www.grapecity.com/activereportsnet/docs/latest/online/formatted-text.html

    I would highly suggest going through the above documentation as information such as compatible HTML tags and using mail merge is given in this page.

    Please also refer to the attach sample application for reference. Make sure to reassign the data source as the path of the data source would be different in your machine.

    MailMerge.zip

  • Posted 26 July 2022, 11:39 am EST

    Hi,

    Thanks for your response, although I think you’re misunderstanding the situation slightly.

    Yes I am aware of the features of the Formatted Text control and its ability to provide inline styling of mail merged fields.

    However, the issue we’re really facing is that there is no obvious ability to easily change the rendered representation of an inline field value.

    I want to be able to change a field value from its numeric representation, to a string representation - for example a currency with leading currency symbol and fixed decimal places.

    In SSRS there are a number of string formatting functions available. Format(), FormatCurrency(), FormatDateTime(), FormatNumber(), FormatPercent() (along with a number of other string manipulation functions). But there don’t seem to be any similar string functions in ActiveReports.

    Ideally I would like to be able to set my Textbox to a value similar to:

    =FormatCurrency(Fields!FeeAmount.Value) & " per payment"
    

    It seems that ActiveReports does have support for functions that manipulate field values at run/render time (ie: there’s a bunch of Common Functions under headings such as DateTime and Math) - but there are none related to common string formatting/conversions.

    Even just a Format() function that takes a format string like the Format property of the TextBox control would be really useful.

    Maybe this is something that could be added to a future version of ActiveReports.

  • Posted 27 July 2022, 5:54 am EST

    Hi Greg,

    Apologies for the misunderstanding. You can also format TextBoxes using the format property of the TextBox Control which works in a similar fashion as the String.ToString() method in C#. You can add your custom formats too for formatting currency or date-time values. For more information on this please refer to the following page of our documentation:

    https://www.grapecity.com/activereportsnet/docs/latest/online/textbox.html#:~:text=is%20not%20supported.-,Format,-Format%20code%3A%20Select

    I have also created a sample report for your reference and attached it along.

    I hope this resolves your issue.

    Format String.zip

  • Posted 5 August 2022, 8:46 am EST

    What I have subsequently discovered is that while there are no string formatting functions listed in the ActiveReports expression editor dialog, the visual basic-based functions that we know from SSRS do seem to work ok.

    I have now had success calling Format(), FormatCurrency() and FormatDateTime() from an expression in ActiveReports.

  • Posted 26 October 2023, 2:58 am EST

    Would you be able to post a simple example? I have the same issue.

  • Posted 26 October 2023, 6:44 am EST

    We’re successfully using

    =FormatCurrency(Fields!FeeAmount.Value) & " per payment"

    and also

    =Format(First(Fields!FeeAmount.Value, "DataSet"), "'$'#,0.00") & " per payment"

    I can’t confirm all of them for sure, but I suspect the following functions are available:

    Format()

    FormatCurrency()

    FormatDateTime()

    FormatNumber(),

    FormatPercent()

    See below for info regarding expected parameters:

    https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications

    https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/formatcurrency-function

    https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/formatdatetime-function

    https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/formatnumber-function

    https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/formatpercent-function

  • Posted 26 October 2023, 8:26 pm EST

    Hi,

    Firstly, thank you Greg for sharing the information with us, as it will help others resolve their issue too.

    You can use the Visual Basic-based Format functions to format your string in the TextBox control. Please refer to the attached sample.

    Attachment: TextBoxExpressionSample.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels