Now that we successfully set up a POST and GET web service block combination we can look into the possibilities of editing the data that has been submitted. This tutorial will be the next step up in difficulty. 


 

Prerequisites


  • Parts 1 and 2 of the web service tutorials need to be completed.


Section I - Add the PUT web service block


  1. Make note of all the fields from your POST web service block as you will need these field names for the input parameters.


  2. Then, select the "Info" block from the GET web service block that was created in the previous tutorial.
    This will make sure that we place the block in the right location, as the PUT web service block needs to be able to use the data that the "All Reports" block retrieves.


  3. Add a Web service block by clicking the red "+ Block" button and selecting it from the Pro blocks tab.


  4. Select AppMachine as provider.


  5. Select the PUT option from the list of predefined web service types.


  6. Enter the name of your database. In our case it's "reports". 
    !!! Note: You can ignore the dropdown that pops up when you select the field. !!!

  7. Open the Objectid dropdown, scroll down and select the _id field from the "All Reports" block.

    It will look something like this: 
    The dataprovider number may be different for your app if you've made web service blocks before.


  8. Next, you will need to enter all the fields from your POST/GET web services. Add the appropriate amount of fields and enter the names. 

    Then, click the dropdown field below the "Value" column and select all the items corresponding with the field names you added under the "Name" column: 
    The end result should look something like the image above. You can enter these manually as well.


  9. Click "Next" and confirm that the web service block has successfully been created. 
    It should say "True" for the success field.


  10. Hit "Next" again and name your PUT web service block. 
    Click "Finish".


  11. The last step we'll take in this section is to make sure that the block is in the right location: 



Section II - Editing the layout for the "Edit Report" Screen block


Next we'll make sure that the fields you added in the Web service are shown and pre-populated with the data from the users' profile. 


  1. Select the "Edit" Screen block.


  2. You'll find that block already has fields added, some that are familiar and others that aren't. Remove the "Name", "Objectid"and "Merge" fields as we won't be needing these. 


  3. Next, re-order the fields in the way you want. And you're done with this section. Save and continue. 


Section III - Managing access to the "Edit Report" block


This will be a short one. We only need to make sure that the registered users can reach the "Edit Report" block after they selected an item from the "All Reports" list. 


This can be done by adding a button to to the "Info" Screen block and connecting a Logic action to that button that navigates the user to the Edit Report block when clicked. 


  1. Select the "Info" Screen block and drag a button on to the layout from the "Controls" tab.
    Give your button a suitable Caption and proceed to the next step.


  2. Double-click your newly added button to open the Logic screen.


  3. Click the "+" icon and select the GoTo option.


  4. Select the "Edit Report" block from the dropdown and hit the "Finish" button.


  5. Save your changes and you're basically done!