Using ESCAPEDOUBLEQUOTE function

The ESCAPEDOUBLEQUOTE function helps you to ignore the double quotes that are typically present in JSON type data returned by the server. By escaping double quotes you can process the JSON values as valid data for any further processing.

Syntax

ESCAPEDOUBLEQUOTE(text/json value)

Where,

  • <text/ json value >: is the JSON value returned by APIs or control selections

Now let us take an example to insert data into a MySQL database from the form. There would be multiple rows of data to be inserted using the Form repeat control. The form repeat control will return JSON type of output. So the data sent to the insert statement would be as JSON data containing the double-quotes.

In this case that may lead to an error in the Insert query.

Thus we will use the Compute task to escape or ignore the double-quotes.

Now for the Insert query for MySQL database, the Product name thus derived would be sent as a dynamic value. In this example, the Price is also a dynamic value for the repeated rows.

The connector would be configured as seen below with the Insert query fields passed accordingly.

Now if you add a Popup Task to check what values are inserted using the ESCAPEDOUBLEQUOTE() function, you can see the variable values as follows:

In this example for the sake of understanding, we will fetch the RowID for the record added or inserted here. It will be the value returned using the response variable for the current action.

Let us set the value for the text control and see the output using the SetControlValue task.

In this example here we will also see the value that is inserted into the database by using the Inserted ID. We will fetch the details for the record and display it in a text control. The Select Query for the same would be as seen below.

We will bind data to the text control to display the data inserted into the database.

You can see that the data has been entered properly with no error by ignoring the double-quotes.