I migrated an access database into SQL Server Management Studio now I am trying to recreate forms using K2 Smartforms. In one of the item views I chose a multi-select control and linked it to a smartobject that stores the data. I need the selected items to store in another smartobject which saves to a sql table. For some reason I can't get it to work. The item view is for data entry and the multi-select control on the item view comes from a different table which has a relationship with two other tables in sql. When I test the item view which is a form now does not save the information to the table to the related table I need the data stored in. I have been playing with the conditions, rules and actions. I may be selecting the wrong ones. I was trying to avoid adding a specific column in the sql table to get this to work the way I need. Any suggestions or help is greatly appreciated.
Solved! Go to Solution.
You basically need to execute the for selected items in the multi-select list view, see attached for a working example explanation.
I am able to get the items to move but the issue is the selected item is not going to a seperate table. The particular form has three tables. One table is a parts table that stores data. The other table is a programs table that has the multiselect list. The third table is supposed to store program name and part number from the other two tables when saved. For some reason when I follow this and test it out i do not see that data stored in the third table but the first table stores part of the data. I am attaching the screenshots. The highlighted are the ones I have been playing around with based off your response was a big help however I am not getting what I need. I am also attaching a query from my SQL table where the data need to go however it is not showing up. I am working in a testing environment and I don't think that should be an issue because other data is going where it needs to.
Don't think it'll be because it is an item view - I just used a list view to show the data had been saved correctly.
It is difficult to say without actually seeing your solution.
I'm not sure what the list method call there is for on the dbo.tblPrograms? You definitely won't get back a list of all those items in a meaningful manner, unless you are just expecting one result back that has been called with a parameter specified.
In this scenario I would start by adding a message box with all of the values in it that you are trying to store that mimics the values that you are passing to the create method of the dbo.tblProgramParts method to verify that indeed you are getting the correct values and the correct number of iterations.
If you could screenshot the actual rule configurations underneath then that may help.
I believe I resolved it. I was able to get it to save in the table. Now I have the fix the double entry highlighted in yellow on SQL Query. I played around with your suggestion and I was able to get it to work. I just have to fix the form so it clears/ refresh form. I am attaching screenshots just in case someone needs reference if they have some issues. It is not 100 percent however playing around with your solutions did help me a lot. I just have to play around to get it to refresh. I am so happy I want to cry. I have been trying to solve this for almost a month. Thank you so much for your help. I am new to K2 so it is a learning experience for me.
For the double entry issue, it looks like you're using a stored procedure to add the data to the table - I would add a check in there to see if the entry already exists, if so then don't add again.