Solved

List view row updated by clicking on the Save button

  • 6 October 2018
  • 3 replies
  • 2 views

I have created a smart form. And dragged the item view and list view in there. I have linked the list view to my smart object (using the SQL). The requirement is I need to write a few numbers in my textbox and when I click on the Save button (these are in the item view), it should update the row of the list view and also update the SQL database table by adding a row in there.

I am stuck at this point. 

 

icon

Best answer by RaymondJVR 9 October 2018, 17:19

View original

3 replies

on save button click add a rule ....call smartobject create method ...pass values from control of item view..and in next rule execute refresh method of listview.

 

That's it.

 

Ttake a look at the expense claim tutorial on the help site.  It has an example of a small application that covers SmartObjects, forms, and workflows.  You might also want to consider one of the training classes K2 offers.

 

David

Good Day Mani


 


By the looks of you request you simply need to ensure that your SQL table is exposed via the SQL service instance and then make use of some rules on the item views save button which would need to save the data entered in the text box to the smartobject, the list view will then need to be refreshed since it is pulling the data from the same smartobject that is being updated, this will ensure that when the smartobejct is updated from the item view the list view will refresh and the update would reflect in the list view as well as in the smartobject.


 


I do however see an issue that you migh be encountering:  When you do the update from the item view, I presume that you do not specify which record needs to be updated by providing the record ID and that you only specify the value that a specific cell should be updated to. This in essance means that the update method which is firing on the Save button click does not know which of the (lets say) 153 records it should update as no unique identifier is specified.


 


To test the above, you can simply do the following:


1) Make sure that you do have some records added in the SmartObject.


2) Then you will need to add another input control (text box) to the Item View (This text box would be the container for the record that needs to be updated).


3) Since the item view is on the same form as the list view you can either transfer the ID of a selected record from the list view to the text box created in step 2 when an record is clicked in the list view. Then when the Save button is clicked that ID value needs to be passed into the Update method (see screenshot below).


 



OR


The ID could be typed into the text box manually but the Update method will still need the Text Box created in step 2 as the ID's Input. 


 


Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such using the 'Mark as Solution', 'Kudo' andor Me Too options.


 


Kind Regards


Raymond

Reply