Articles in this section
Category / Section

How to Include Double Quotes in a String

Published:
Updated:

In Bold Reports, there are often scenarios where you need to include double quotes within a string. Whether you’re generating dynamic text or incorporating data from external sources, the ability to handle double quotes is crucial. In this article, we’ll explore how to include double quotes in strings using the CHAR(34) function in Bold Reports.

Example Expression for Web API Request Body

To include double quotes in a JSON payload, you can use the Chr(34) function in your expression as shown below:

="{" &
  Chr(34) & "id" & Chr(34) & ":" & Chr(34) & 1 & Chr(34) & "," &
  Chr(34) & "name" & Chr(34) & ":" & Chr(34) & Parameters!Name.Value &
"}"

This expression generates a JSON object with the following structure:

{
  "id": 1,
  "name": "Ram" //This value comes from the name parameter.
}

Steps to use Chr(34) in JSON payloads in Bold Reports

To include double quotes in your JSON payload using Chr(34) in the Bold Reports application, follow these steps:

  1. In your Web API datasource, use your REST API endpoint in the URL text box to perform a POST action.
  2. Select POST in the Method drop-down and switch to the Raw radio button. A text area with an option to set an expression will be displayed.
  3. Choose the Expression option from the menu to launch the expression dialog.
    WEBAPI.png
  4. Enter the expression like the example code above and click OK.
    Rawdata.png
  5. Enter valid raw details in the required fields and click OK to confirm.
    ConnectionData.png
  6. Your data source is now successfully created with the correct JSON payload.

Using the Chr(34) function is a simple yet effective way to include double quotes in JSON strings, ensuring that your JSON payloads are correctly formatted for Web API requests.

See also

For additional information on connecting to a Rest API data source, you can refer to the following link.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied