Missing terminal " character

Hi, can someone please explain to me why there is a missing terminal " character in the codes below?

void loop() {
// Construct a Flux query
// Query will find the worst RSSI for last hour for each connected WiFi network with this device
String query = "from(bucket: "" INFLUXDB_BUCKET "")
|> range(start: -1h)
|> filter(fn: (r) => r._measurement == "wifi_status" and r._field == "rssi" and r.device == "" DEVICE "")
|> min()";

I think the double quotes are wrecking the syntax.

In C a literal " within a character string would be escaped with a backslash; this may be different in whatever you are talking to.

Serial.pritnln(" I need to print a \" character");

a7

There is not a missing ".

Opening at String query = " and Closing at min()"

I assumed the OP was paraphrasing an error thrown somewhere by something.

I further assume that the double quotes, two " in a row, are not being handled as desired, irrespective of the possibility that the "" syntax is used elsewhere (other programming languages or) to mean ".

And I'm tired of wrestling with markdown over the quoting of quotes. :wink:

a7

/* please put some text you'll search for one day here */

void setup()
{

}

void loop() {

String query = "from(bucket: \"\" INFLUXDB_BUCKET \"\")\
|> range(start: -1h)\
|> filter(fn: (r) => r._measurement == \"wifi_status\" and r._field == \"rssi\" and r.device == \"\" DEVICE \"\")\
|> min()";

}

So… you need to escape the internal quote characters. And use \ at the end of lines to make a long, one line character string with internal quotes.

The above compiles. And should preserve the "" thing for the Flux Capacitor Query.

a7

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.