Wappler Version : 3.8.2
Operating System : Win10
Server Model: NodeJS
Database Type: PostgreSQL
Hosting Type: Docker
Expected behavior
What do you think should happen?
When you select the identity output from an INSERT server action step, it should return the ID of the record that was just inserted.
Actual behavior
What actually happens?
It is returning the text 'INSERT' instead.
This link below seems to be the same bug from last year that was closed off:
How to reproduce
- Detail a step by step guide to reproduce the issue
- A screenshot or short video indicating the problem
- A copy of your code would help. Include: JS, HTML.
- Test your steps on a clean page to see if you still have an issue
As above, simply duplicate my server/wappler environment and create a simple insert step and then a 'set value' step to output the identity of the previous insert.
Here is a sample i've created:
Here is the JSON API file:
[
{
"name": "insert",
"module": "dbupdater",
"action": "insert",
"options": {
"connection": "db",
"sql": {
"type": "insert",
"values": [
{
"table": "rosters",
"column": "name",
"type": "text",
"value": "Identity Test Insert"
}
],
"table": "rosters",
"query": "INSERT INTO rosters\n(name) VALUES ('Identity Test Insert')",
"params": []
}
},
"meta": [
{
"name": "identity",
"type": "text"
},
{
"name": "affected",
"type": "number"
}
],
"output": true
},
{
"name": "value_identity",
"module": "core",
"action": "setvalue",
"options": {
"value": "{{insert.identity}}"
},
"output": true
}
]
Here is the output in Chrome:
{"insert":{"affected":1,"identity":"INSERT"},"value_identity":"INSERT"}
I am using the latest Wappler and the db.js file in lib/core
was updated in Nov/2020 since the previous post/bug was fixed.