Which SC steps for multi updates in a single column for single user (screenshots)?

Hello folks,
I can’t seem to find the right SC setup for recording new keyword inputs from my bootstrap table into my DB.

I have tried both the DB multi-update (which generates a repeat in the action steps and a DB update step with a {keyword} binding value) and the DB “single” update actions but either no data is sent from my input field to the DB table or the data in the DB is deleted (12 single update actions).
image
image
I’m doing something wrong, any insights on how to set this up would be highly appreciated! Thank you.

What is the expected output here?
Your screenshots seem to show everything as it should be.
You have 12 inputs. DB has 12 rows inserted. There is value in 2-3 inputs… DB has value in 2-3 inputs.

Output 1 and 2 (SEO & marketing) were previously recorded during user registration. This step now is profile update.
When I send input 3 (new keyword), the SC does not record anything, no data updates in the DB with ‘new keyword’ as a new keyword in line 3 of the table.

Is this $_POST.record[0].keyword normal when I select the “multi” variable POST.keyword?

It seems you are selecting a wrong binding in the data picker … you need to select the value from the repeat, not the POST var.

Thanks I fixed this but still no updates in the DB. Do i have to pick the ‘keyword’ output field in the properties? I tried before with and without, still nothing…
image

I’m not sure what exactly are you doing there.
Didn’t you use the multi update step to generate your inputs and then create the form? Why is the keyword post variable under record marked as multiple?

I created a bootstrap form (generator) then imported the fields. It first generated the ‘keyword’ POST var, then when I created the repeat step, the record.keyword input was generated. Not sure about the order of the steps here. What may be wrong?
image image

I still get NULL in the repeat response, no matter what i setup in this SC step. Could it be something in the AS?

That is not the correct workflow as the inputs need a specific naming, which you probably did not add.
I suggest you to start from scratch.

  1. In server action add the multi update step and select the table/columns to update.
  2. Then on the page use the form generator and create your update form (don't forget to check the multiple records in the generator options).

Ok thanks, did SC steps 1st, multi record generator 2nd. It created a repeat children (expression: consultDetailsConnect.data.qryKeywords) within the submit form. Still no update in the DB. Keyword input name and field name match. Why those odd values in the txt input properties? Why the submit button has a save value in the dynamic attribute?

Instead of adding a 3rd new keyword (first 2 already in DB), it deletes them and no add, yet:
image

Can you please paste the form code here?

<form is="dmx-serverconnect-form" id="keywordFields" method="post" action="dmxConnect/api/consultant/updConsultKeys.php" dmx-generator="bootstrap4" dmx-form-type="horizontal" dmx-multi="true"

                      dmx-populate="consultDetailsConnect.data.qryKeywords">

                      <div id="record" is="dmx-repeat" dmx-bind:repeat="consultDetailsConnect.data.qryKeywords">

                         <div class="form-group row">

                            <div class="col-sm-10">

                               <input type="text" class="form-control" id="inp_keyword" name="keyword" dmx-bind:id="insp_keyword_{{$index}}" dmx-bind:aria-describedby="insp_keyword_{{$index}}_help" dmx-bind:name="record[{{$index}}][keyword]"

                                  dmx-bind:value="keyword" aria-describedby="inp_keyword_help" placeholder="Enter Keyword">

                            </div>

                         </div>

                      </div>

                      <div class="form-group row">

                         <div class="col-sm-10">

                            <button type="submit" class="btn btn-primary" dmx-bind:value="Save">Save</button>

And how is the condition set in the update record step? What expression is set there?

    <?php

    require('../../../dmxConnectLib/dmxConnect.php');

    $app = new \lib\App();

    $app->define(<<<'JSON'

    {

      "meta": {

        "options": {

          "linkedForm": "formKeywords",

          "linkedFile": "/consultant-dashboard.php"

        },

        "$_POST": [

          {

            "type": "array",

            "name": "record",

            "sub": [

              {

                "type": "text",

                "fieldName": "keyword",

                "name": "keyword"

              },

              {

                "type": "number",

                "name": "userid"

              }

            ]

          }

        ]

      },

      "exec": {

        "steps": {

          "name": "record_repeat",

          "module": "core",

          "action": "repeat",

          "options": {

            "repeat": "{{$_POST.record}}",

            "outputFields": [

              "keyword"

            ],

            "exec": {

              "steps": {

                "name": "record_update",

                "module": "dbupdater",

                "action": "update",

                "options": {

                  "connection": "DB",

                  "sql": {

                    "type": "update",

                    "values": [

                      {

                        "table": "keywords",

                        "column": "keyword",

                        "type": "text",

                        "value": "{{keyword}}"

                      }

                    ],

                    "table": "keywords",

                    "wheres": {

                      "condition": "AND",

                      "rules": [

                        {

                          "id": "user_id",

                          "field": "user_id",

                          "type": "double",

                          "operator": "equal",

                          "value": "{{userid}}",

                          "data": {

                            "column": "user_id"

                          },

                          "operation": "="

                        }

                      ],

                      "conditional": null,

                      "valid": true

                    },

                    "query": "UPDATE keywords\nSET keyword = :P1 /* {{keyword}} */\nWHERE user_id = :P2 /* {{userid}} */",

                    "params": [

                      {

                        "name": ":P1",

                        "type": "expression",

                        "value": "{{keyword}}"

                      },

                      {

                        "operator": "equal",

                        "type": "expression",

                        "name": ":P2",

                        "value": "{{userid}}"

                      }

                    ]

                  }

                },

                "meta": [

                  {

                    "name": "affected",

                    "type": "number"

                  }

                ]

              }

            }

          },

          "meta": [

            {

              "name": "$index",

              "type": "number"

            },

            {

              "name": "$number",

              "type": "number"

            },

            {

              "name": "$name",

              "type": "text"

            },

            {

              "name": "$value",

              "type": "object"

            },

            {

              "name": "keyword",

              "type": "text"

            },

            {

              "name": "userid",

              "type": "number"

            }

          ],

          "outputType": "array",

          "output": true

        }

      }

    }

    JSON

    );

    ?>

Well the POST variable which is used to filter your update record data (my screenshot shows mine called memid), which can be found in the condition:

In your case called userid

is missing from your form. You should not remove it. You need this field so the script can identify which record to update …
Change it to type hidden in the form generator, so it’s not visible:

I fixed this but still no DB updates. (linked field properties with same name as input field name.)
I do not understand these odd looking values in the input properties. It has never worked with such values. I’m doing other DB updates fine with no such record[{{$index}}][keyword]

These "odd looking values" are required for multi update forms. They are correct.
Are you 100% sure you now have the id input in the form?

Yes, looks like this

Anyting wrong there?