Populating modals with control values
1. Populating modals with control values
2. DEMO script
Great job using basic actions to trigger a series of events in your app. In this video, we'll leverage Sigma actions to add and update data in input tables. A key feature of many Sigma apps, including the ones we've been building so far in this course, is the need to capture and record user input in a table. For example, in our loan approval app, we need to capture loan officer approval decisions and their comments. While there is no functionality in Sigma which allows overwriting data already in your data platform, Sigma does allow us to add, remove and update the rows in input tables. Triggering an ‘update row’ effect by clicking a button In our loan approval app, we ask loan officers to approve or reject loan applications and to leave us comments about their decision. As soon as they click ‘Approve’ or ‘Reject’, we want their decision and comments to be added to the application’s row in the input table. Let's set up an action sequence to make this happen. In the Approve button’s action panel, we'll configure an action sequence with a trigger of ‘On click’. The effect will update a row in a linked input table. In the update row menu we select the input table being updated and in this case, we'll opt to update a single row at a time. There are other options for how to update rows in linked input tables, but they're out of scope for this course. Next we specify how to identify the correct row to update. In an earlier exercise, we added a control value for the current loan application ID being reviewed. We can reference it here by navigating to the control’s location. Now we can choose into which of the row’s columns to input our data. We'll add the approval decision column and because this is the Approve button action we’ll ask it to update with a static value of the word ‘Approved’. We'll also add the comments to the comments column by referencing the Comments control in this modal. A good best practice when working with controls in apps is to clear away the control’s stored values after they've been used for their intended purpose. If we leave the control values in place, they could interfere with subsequent actions or tasks we set up in the app. This modal is using two controls, the current loan application ID being reviewed and also the comments being added. We’ll add one effect that clears all the controls on our app controls page, just in case we add more controls to the page later, and we’ll also clear the specific ‘Comments’ control from the modal. Finally, we’ll automatically close the modal at the end of the sequence by adding an effect called ‘Close modal’. Let's try it out. When we click to review an application the modal opens, we type some commentary and click ‘Approve’. We see that the modal closes automatically and the linked input table has updated. Viewing the app controls page and the modal we see that the control values have been cleared. We won't repeat it here, but of course it would be good practice to go back to the Reject button in the modal and configure a similar set of steps, adding the word rejected to the decision column and any comments.3. Let's practice!
Now it's your turn to give it a try. In the next exercises, you'll add action sequences to your loan officer promotion app to update rows in a linked input table.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.