Anybody know if what I’m trying to do with Data Manipulation plugin is possible, without using the API Server provided by Volkov Labs and a PostgreSQL behind?
Thanks in advance four your help.
Regards,
Alejandro
First of all, thanks for all your answers in all my questions about Volkov’s Labs plugins after a few minutes that I asked, really appreciated.
I reviewed the documentation about the plugin, and I already tried to use ${note} in the URL with no luck (is not being replaced with the value) before I created my post here.
I did a small POC to do troubleshooting and show you:
As you can see, my expectation is to receive “this-is-a-test” as the value of the “note” field on “query” and on “url”, but I’m receiving “${note}”, and I’m only getting the value “this-is-a-test” in the payload and in the “note” field in the body of the HTTP POST Request.
As an additional test, I added a Grafana’s variable to the URL, with the name “id”, and put it a hardcoded value in the dashboard, “25”, and is working as expected (I get “25” as the value of “id” field on “query” and on “url”.
Am I understanding something wrong? Or something is not behaving as expected?
Abusing of your good will, I add a question here: how is the Data Manipulation plugin, in particular the Text Area Type field of a form element, managing the new lines?
Because when I add a note from Grafana, via API, to the end application, I’m loosing the new line:
On NodeRED, I can see the new line in the payload of the message, in the form of “↵” (which is replaced “visually” if I do a click on the payload with the newline), but in the URL and on the query field is erased (not even replaced by \n), while spaces are replaced by %20:
Sorry if this question is more referred to the way that Javascript replace the ${body["note"]} in the URL, and not mainly to the Data Manipulation plugin itself. The question is to try to understand, because I’m not a Javascript Developer, I’m just a script kiddie with willpower,
The only problem is that I need to use the “note” field inside “body” or “payload”, which both have the “%0A” in the middle, and I cannot use the “note” field inside “query”, because it don´t has the “%0A” (I really don’t understand why). This obliges me to use NodeRED to do that “transpolation” from body/payload to query in the API call to the end service; I cannot do the API call directly to the end service because of that.
And finally, I added to your example code the option to notify on success and on error, and clean the field after submit:
@alejandroguida, I read your response multiple times, but I can’t say that I understood it correctly.
The %0A corresponds to \r, which is the Windows-style new line - \r\n to be exact. The text area returns new lines \n in Unix style (I am on Mac). Is it what the issue is?
If you need to have different formatting in the payload (body) and query parameter, then don’t replace it in the body. Replace it directly in the query.
I think that the end application API only allows %0A as new line, and that was the main problem.
I tried first to do the replace directly in the query when I was doing the troubleshooting, but I really don’t know why, didn’t work.
I tried again with your suggestion now (I think is similar to what I did when I was doing the troubleshooting, but I don’t remember), and again, didn’t work.
I used the definition of the constant like you wrote it, and tried too with an additional “}” after “name”, like this:
Hi mik
I am using your example code,
options.elements.forEach((element) → here I am getting the “Form Elements ID” but not getting the value what I entered in the fields. What I am doing wrong here…