Best working practices regarding Server Connect Variables?

I am looking for clarification of best working practices regarding Server Connect Variables.

In this simple example I have about 12 Server Connect Components on the page, 7 of which have an Input Parameter/Variable "business_ID_var" and there are 7 Modals, each has a different but similar role of updating or inserting an element of the business information.

Here is the variable...
<dmx-value id="business_ID_var" dmx-bind:value=""></dmx-value>
Here are the 7 Server Connect Components each with the same `dmx-param`...
<dmx-serverconnect id="people_q_detail" url="../dmxConnect/api/Admin-People/people_q_detail.php" dmx-param:people_id_getvar="people_ID_var.value" dmx-param:business_id_getvar="business_ID_var.value"></dmx-serverconnect>
<dmx-serverconnect id="business_address_sc" url="../dmxConnect/api/business_folder/business_address_actions.php" dmx-param:business_id_getvar="business_ID_var.value"></dmx-serverconnect>
<dmx-serverconnect id="business_details_sc" url="../dmxConnect/api/business_folder/business_details_actions.php" dmx-param:business_id_getvar="business_ID_var.value"></dmx-serverconnect>
<dmx-serverconnect id="business_people_sc" url="../dmxConnect/api/business_folder/business_people_actions.php" dmx-param:business_id_getvar="business_ID_var.value"></dmx-serverconnect>
<dmx-serverconnect id="business_comms_sc" url="../dmxConnect/api/business_folder/business_comms_actions.php" dmx-param:business_id_getvar="business_ID_var.value" dmx-param:var_comm_id="var_comm_id.value"></dmx-serverconnect>
<dmx-serverconnect id="business_principal_sc" url="../dmxConnect/api/business_folder/business_principal_actions.php" dmx-param:business_id_getvar="business_ID_var.value"></dmx-serverconnect>
<dmx-serverconnect id="sc_principals_reports_fees" url="../dmxConnect/api/business_folder/sa_principal_reports_fees.php" dmx-param:business_id_getvar="business_ID_var.value"></dmx-serverconnect>

I am finding that when I initiate one of the Modals using an <a> tag like this

dmx-on:click="business_ID_var.setValue($value[0].business_id); mod_business_add_n_edit.show()"

that all of the Server Connect Components fire when only one is needed or associated to that Modal.

These Server Connect Components are used to populate the forms within the Modals. So one Server Connect Component required per Form per Modal.

In my head I am thinking that I should create a separate variable for each of the Server Connect Components like this

<dmx-value id="business_ID_var_people_detail" dmx-bind:value=""></dmx-value>
<dmx-value id="business_ID_var_address" dmx-bind:value=""></dmx-value>
<dmx-value id="business_ID_var_details" dmx-bind:value=""></dmx-value>
etc

Am I correct? Or should I be doing things in a different way?

If you can keep the server connects on “No Auto Load” that would be the best option.
On click, you can set the variable, and then call the relevant SC.

Also, you can avoid setting the variable and call the relevant SC by setting just the business id in load… and the rest of the params will be picked up by DMX based on the binding in the SC definition.

The way AppConnect/DMX is set to work is if any of the bound element in a auto-loading SC changes, it will reload the SC. Hence you see all the SCs loading on click of link.

Ah, that’s what I was after (I think), that makes great sense. Thanks @sid for the clear guidance once again :slight_smile:

Just starting to play with your suggestions and I go to add the "Server Connect > Load" and I get some strange behaviour.

The Server Connect Name does not display correctly in the Server Actions dialog box, nor does it display correctly in the Code

dmx-on:click="business_ID_var.setValue($value[0].business_id);business_name_var.setValue($value[0].business);mod_business_add_n_edit.show();_details_sc.load({business_id_getvar: business_ID_var.value},true)"

@Teodor has this been reported before?

Haven’t seen this before. Must be a new bug.