Tutorial for the database multi update

Hi I am wondering if there is a tutorial for how to use the multi update sever connect?
Thanks
J

Have a look at and following videos

1 Like

Hi @ben thanks for your reply! I watched the video, but it looks it is for multiple file upload, I am looking is for information on how to use the database muliti update feature.


I was successful at using the multi insert, but the multi upload is not working.
@Teodor @patrick wondering if there is any of this content created.
Thanks
J

Please check:

1 Like

@Teodor thanks for getting back to me. Ok, so I think I have followed the instructions, but it is still not working for me.

So perhaps I can give some background as to what I am trying to accomplish, then provide a description of the actions I am doing in wappler to do it.

The request:
I have created a system that creates tickets for accessibility. each ticket/record in the ticket’s table has a relationship to other records in other tables (multiple records).

Currently there is a need to move a ticket from one project to another, this is just updating the main Id within the project. (this works as expected)

Now I want to also ensure that the id information for the project and organization is also changed, in the other tables.

So I have created a form repeat like the one you inidicated int he tutorial.

<div dmx-repeat:rpwcagMove="scProjects.data.qrTicketsElementsSCIAll" id="rpwcagallInfo5">

                            
<input id="inp_ticket_sci_IDN" name="ticket_sci_ID" dmx-bind:id="insp_ticket_sci_ID_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_ID]" dmx-bind:value="ticket_sci_ID">

                            <br>

                            <input id="inp_pr_IDCreateElementCSGCP" name="pr_ID" dmx-bind:id="insp_pr_IDCreateElement_{{$index}}" dmx-bind:name="record[{{$index}}][pr_ID]" dmx-bind:value="pr_IDMoveTicket.value">

                            <br>

                           <input id="inp_prelement_IDN" name="prelement_ID" dmx-bind:id="insp_prelement_ID_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_version]" dmx-bind:value="prelement_IDMoveTicket.value">

                            <br>

                            <input id="inp_org_IDCreateElementCSGCP" name="org_ID" dmx-bind:id="insp_org_IDCreateElement_{{$index}}" dmx-bind:name="record[{{$index}}][org_ID]" dmx-bind:value="org_IDMoveTicket.value">

                        </div>

Here is what I am doing in the server connect panel to get the multi update

However when the form saves, only the first step gets executed.

I know I am missing something but not sure what it is.

Thanks for your help.

J

Why do you think so? How did you end up with this conclusion?

The records I am trying to updated in the database for the multi database updates do not get updated, only the first step.
Thanks
J

Which value exactly are you trying to edit in the multi update form? Please post your whole form code, and format it as explained here:

@Teodor thanks for getting back to my and for the suggestion.
The image below outlines the fields that I am trying to update with the multi update

And here is the code, using the guidelines you’ve proved:

<div dmx-repeat:rpwcagMove="scProjects.data.qrTicketsElementsSCIAll" id="rpwcagallInfo5">

                            <input id="inp_ticket_sci_IDN" name="ticket_sci_ID" dmx-bind:id="insp_ticket_sci_ID_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_ID]" dmx-bind:value="ticket_sci_ID">
                            <br>
                            <input id="inp_pr_IDCreateElementCSGCP" name="pr_ID" dmx-bind:id="insp_pr_IDCreateElement_{{$index}}" dmx-bind:name="record[{{$index}}][pr_ID]" dmx-bind:value="pr_IDMoveTicket.value">
                            <br>
                            <input id="inp_prelement_IDN" name="prelement_ID" dmx-bind:id="insp_prelement_ID_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_version]" dmx-bind:value="prelement_IDMoveTicket.value">
                            <br>
                            <input id="inp_org_IDCreateElementCSGCP" name="org_ID" dmx-bind:id="insp_org_IDCreateElement_{{$index}}" dmx-bind:name="record[{{$index}}][org_ID]" dmx-bind:value="org_IDMoveTicket.value">
                        </div>

Note, the above code is within the form, would you need to see the form as well?
Thanks
J

I need to see the WHOLE form code please.

here it is

<form id="fmMoveTicket" is="dmx-serverconnect-form" method="post" action="/dmxConnect/api/DA_Projects/Tickets/apiTicketMove.php" dmx-on:success="AlertSucess.success('You have successfully added a watcher to the comments on this ticket!');scProjects.load({});var_WatcherAddClick.setValue(0);modalMoveTicket.toggle();modalMoveTicket.fmMoveTicket.reset()" dmx-on:invalid="var_WatcherAddClick.setValue(0)">
                    <div class="modal-body" id="modalMoveTicketBody">
                        <div class="bs-callout bs-callout-primary bs-callout-xl">
                            <p>
                                <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'en')">
                                    Form fields marked with the (<span class="text-danger fw-bolder">*</span>) are required.
                                </span>
                                <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'fr')">
                                    Les champs de formulaire marqués d'un (<span class="text-danger fw-bolder">*</span>) sont obligatoires.
                                </span>
                            </p>
                        </div>
                        <div class="form-group mb-3">
                            <label class="form-control-label fw-bolder" for="prelement_IDMoveTicket">
                                <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'en')">
                                    Select the project:
                                </span>
                                <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'fr')">
                                    Sélectionnez le projet:
                                </span>
                                <span class="text-danger" aria-hidden="true">*</span>
                            </label>
                            <div class="input-group input-group-merge">
                                <input type="text" class="form-control form-control-prepend" id="pr_IDMoveTicket" name="pr_ID" required="" data-msg-required="It looks like you forgot to select the project." aria-required="true" dmx-bind:aria-invalid="invalid" aria-describedby="dmxValidatorErrorfmMoveTicketpr_ID" is="dmx-autocomplete" optiontext="pr_ID+'-'+pr_name" dmx-on:changed="var_pr_id_ticket_move.setValue(value)" dmx-bind:data="scProjects.data.qrProjectsAllSearch" optionvalue="pr_ID">
                                <div id="dmxValidatorErrorfmMoveTicketpr_ID">
                                </div>
                            </div>
                        </div>
                        <div class="form-group mb-3">
                            <label class="form-control-label fw-bolder" for="prelement_IDMoveTicket">
                                <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'en')">
                                    Select element:
                                </span>
                                <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'fr')">
                                    Sélectionner l'élément:
                                </span>
                                <span class="text-danger" aria-hidden="true">*</span>
                            </label>
                            <div class="input-group input-group-merge">
                                <input type="text" class="form-control form-control-prepend" id="prelement_IDMoveTicket" name="prelement_ID" required="" data-msg-required="It looks like you forgot to select the element." aria-required="true" dmx-bind:aria-invalid="invalid" aria-describedby="dmxValidatorErrorfmMoveTicketprelement_ID" is="dmx-autocomplete" dmx-bind:data="scProjects.data.qrTicketMoveElementsSearch" optiontext="prelement_ID+'-'+prelement_name" optionvalue="prelement_ID" dmx-on:changed="var_prelement_id_ticket_move.setValue(value)" dmx-bind:disabled="!pr_IDMoveTicket.value">
                                <div id="dmxValidatorErrorfmMoveTicketprelement_ID">
                                </div>
                            </div>
                        </div>
                        <input id="org_IDMoveTicket" name="org_ID" class="form-control" dmx-bind:value="scProjects.data.qrTicketMoveElementsSingle.org_ID" dmx-bind:disabled="!pr_IDMoveTicket.value">
                        <!-- WCAG info -->
                        WCAG info
                        <br>
                        <div dmx-repeat:rpwcagMove="scProjects.data.qrTicketsElementsSCIAll" id="rpwcagallInfo5">

                            <input id="inp_ticket_sci_IDN" name="ticket_sci_ID" dmx-bind:id="insp_ticket_sci_ID_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_ID]" dmx-bind:value="ticket_sci_ID">
                            <br>
                            <input id="inp_pr_IDCreateElementCSGCP" name="pr_ID" dmx-bind:id="insp_pr_IDCreateElement_{{$index}}" dmx-bind:name="record[{{$index}}][pr_ID]" dmx-bind:value="pr_IDMoveTicket.value">
                            <br>
                            <input id="inp_prelement_IDN" name="prelement_ID" dmx-bind:id="insp_prelement_ID_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_version]" dmx-bind:value="prelement_IDMoveTicket.value">
                            <br>
                            <input id="inp_org_IDCreateElementCSGCP" name="org_ID" dmx-bind:id="insp_org_IDCreateElement_{{$index}}" dmx-bind:name="record[{{$index}}][org_ID]" dmx-bind:value="org_IDMoveTicket.value">
                        </div>
                        <!-- Screenshots info -->
                        Screenshots info
                        <br>
                        <div dmx-repeat:rpscreenshotsmove="scProjects.data.qrTicketSscreenshotsAll" id="rpwScreenshotsMove">
                            ticket id
                            <input id="inp_ticket_ss_IDSMN" name="ticket_ss_ID" dmx-bind:id="insp_ticket_ss_IDSM_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_ss_ID]" dmx-bind:value="ticket_ss_ID">
                            <br>
                            pr id<input id="inp_pr_IDCreateElementSMCSGCP" name="pr_ID" dmx-bind:id="insp_pr_IDCreateElementSM_{{$index}}" dmx-bind:name="record[{{$index}}][pr_ID]" dmx-bind:value="pr_IDMoveTicket.value">
                            <br>
                            prelement_ID <input id="inp_prelement_IDSMN" name="ticket_sci_version" dmx-bind:id="insp_prelement_IDSM_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_version]" dmx-bind:value="prelement_IDMoveTicket.value">
                            <br>
                            org id<input id="inp_org_IDCreateElementSMCSGCP" name="org_ID" dmx-bind:id="insp_org_IDCreateElementSM_{{$index}}" dmx-bind:name="record[{{$index}}][org_ID]" dmx-bind:value="org_IDMoveTicket.value">
                        </div>
                        <!-- comments -->
                        comments
                        <br>
                        <div dmx-repeat:rpComments="scProjects.data.qrTicketsComments" id="rpCommentsMove">
                            comt_ID
                            <input id="inp_comt_IDCN" name="comt_ID" dmx-bind:id="insp_comt_IDC_{{$index}}" dmx-bind:name="record[{{$index}}][comt_ID]" dmx-bind:value="comt_ID">
                            <br>
                            pr id<input id="inp_pr_IDCreateElementCCSGCP" name="pr_ID" dmx-bind:id="insp_pr_IDCreateElementC_{{$index}}" dmx-bind:name="record[{{$index}}][pr_ID]" dmx-bind:value="pr_IDMoveTicket.value">
                            <br>
                            prelement_ID <input id="inp_prelement_IDCN" name="ticket_sci_version" dmx-bind:id="insp_prelement_IDC_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_version]" dmx-bind:value="prelement_IDMoveTicket.value">
                            <br>
                            org id<input id="inp_org_IDCreateElementCCSGCP" name="org_ID" dmx-bind:id="insp_org_IDCreateElementC_{{$index}}" dmx-bind:name="record[{{$index}}][org_ID]" dmx-bind:value="org_IDMoveTicket.value">
                        </div>
                        <!-- comments Reply -->
                        Reply
                        <br>
                        <div dmx-repeat:rpCommentsReply="scProjects.data.qrTicketMoveReply" id="rpCommentsReplyMove">
                            comtrpy_ID
                            <input id="inp_comtrpy_IDCRN" name="comtrpy_ID" dmx-bind:id="insp_comtrpy_IDCR_{{$index}}" dmx-bind:name="record[{{$index}}][comtrpy_ID]" dmx-bind:value="comtrpy_ID">
                            <br>
                            pr id<input id="inp_pr_IDCreateElementCCSGCR" name="pr_ID" dmx-bind:id="insp_pr_IDCreateElementCR_{{$index}}" dmx-bind:name="record[{{$index}}][pr_ID]" dmx-bind:value="pr_IDMoveTicket.value">
                            <br>
                            prelement_ID <input id="inp_prelement_IDCR" name="ticket_sci_version" dmx-bind:id="insp_prelement_IDCR_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_version]" dmx-bind:value="prelement_IDMoveTicket.value">
                            <br>
                            org id<input id="inp_org_IDCreateElementCCSGCR" name="org_ID" dmx-bind:id="insp_org_IDCreateElementCR_{{$index}}" dmx-bind:name="record[{{$index}}][org_ID]" dmx-bind:value="org_IDMoveTicket.value">
                        </div>
                        <!-- comments watch -->
                        comments watch
                        <br>
                        <div dmx-repeat:rpCommentsWatch="scProjects.data.qrWatchAll" id="rpCommentsWatchMove">
                            comtrwatch_ID
                            <input id="inp_comtrwatch_IDCWN" name="comtrwatch_ID" dmx-bind:id="insp_comtrwatch_IDCW_{{$index}}" dmx-bind:name="record[{{$index}}][comtrwatch_ID]" dmx-bind:value="comtrwatch_ID">
                            <br>
                            pr id<input id="inp_pr_IDCreateElementCWCSGCP" name="pr_ID" dmx-bind:id="insp_pr_IDCreateElementCW_{{$index}}" dmx-bind:name="record[{{$index}}][pr_ID]" dmx-bind:value="pr_IDMoveTicket.value">
                            <br>
                            prelement_ID <input id="inp_prelement_IDCWN" name="ticket_sci_version" dmx-bind:id="insp_prelement_IDCW_{{$index}}" dmx-bind:name="record[{{$index}}][ticket_sci_version]" dmx-bind:value="prelement_IDMoveTicket.value">
                            <br>
                            org id<input id="inp_org_IDCreateElementCWCSGCP" name="org_ID" dmx-bind:id="insp_org_IDCreateElementCW_{{$index}}" dmx-bind:name="record[{{$index}}][org_ID]" dmx-bind:value="org_IDMoveTicket.value">
                        </div>
                    </div>
                    <div class="modal-footer">
                        <div class="float-end">
                            <div class="input-group">
                                <button type="button" class="btn btn-outline-primary" data-bs-dismiss="modal">
                                    <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'en')">
                                        Cancel
                                    </span>
                                    <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'fr')">
                                        Annuler
                                    </span>
                                </button>
                                <button type="submit" class="btn btn-primary" dmx-show="(var_WatcherAddClick.value == 0)" dmx-on:click="var_WatcherAddClick.setValue(1)">
                                    <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'en')">
                                        Save
                                        <span class="sr-only">
                                            watcher
                                        </span>
                                    </span>
                                    <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'fr')">
                                        Enregistrer
                                        <span class="sr-only">
                                            l'observateur
                                        </span>
                                    </span>
                                </button>
                                <button class="btn btn-primary disabled" dmx-show="(var_WatcherAddClick.value == 1)">
                                    <div class="spinner-border spinner-border-sm text-info me-2" role="status">
                                        <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'en')">
                                            <span class="sr-only">Saving...</span>
                                        </span>
                                        <span dmx-show="(scAppSettings.data.qrUserLanguage.user_language == 'fr')">
                                            <span class="sr-only">Économie...</span>
                                        </span>
                                    </div>
                                </button>
                            </div>
                        </div>
                    </div>
                    <input id="ticket_IDMove" name="ticket_ID" type="hidden" class="form-control" dmx-bind:value="scProjects.data.qrTicketsElementsSingle.ticket_ID">
                </form>

How exactly did you generate this code?
Its id should match your update record server action:

Screenshot 2023-03-17 at 16.39.03

also the code that the form generator creates is:

<div id="record" is="dmx-repeat" dmx-bind:repeat="scProjects.data.qrTicketsElementsSCIAll">

not really sure how did you end up with a code like that an repeat like that.

1 Like

Hi @Teodor,
I guess I was trying different things, that is how the code was changed, but the information you gave me is what I needed.
Thanks a lot
Regards
J

1 Like