Skip to main content

Hello,

I have to show a view with a Check Box list showing the many-to-many relationship between two SmartObjects.
I have a SmartObject1 and a SmartObject2.
Each SmartObject match a class in my SQL Server database ("Class1" and "Class2").
I have created a third table "Class1Class2" in my database containing the ID's of the two classes to save which "class1" elements have been associated to the "class2" elements
So, to link the data to the Check Box List, I have created a composite smartobject between the 2 SmartObjects via K2 designer.
The composite smartobject's methods are linked by default to the SmartBox Service.
So, I changed the method bindings for the "Get List" method to the ServiceObject method "List" of my SQL Server table "Class1Class2".
I have created a list view from this smartobject, and everything is fine. It shows me the content of the "Class1Class2" table.
But if I try to link to a Check Box List in a view the composite SmartObject as data source, it shows me the list of all values in the "class2" table, but it doesn't check the check boxes elements corresponding to my "Class1Class2".

I spent 2 days doing tests without success.
I think it's an easy case, but I can't find anything about it.

If someone could help me please, Thank you!

Laurent

In order to load checked values in a checkbox list you need to execute the Load method of the view:


configure "Execute Load method of View" action on view initialize and do following mappings:


Input mappings: Required fields of Load method


Output mappings: Map the primary key of your "Class1Class2" table to list view


Doing this will load checked options in checkbox list


 


 


Hello and thank you Abhi.


This helped me. But if I execute the Load method of the SmartObject "Class1Class2" (And not the Load method of the view), I have only the first element found in the DBB checked in the Check Box list. That's logical.


So I decided to execute the Get List method of the SmartObject "Class1Class2" but as the Load method, I have only the first element found in the DBB checked in the Check Box List if I map the output primary key to the Check Box List. But I want to check all the "Class2" elements in the Check Box List corresponding to all the "Class2" elements linked to the current "Class1".


Any idea?


Executing Load method of Smart object will not populate all data in list control. In order to populate data in list control/ list view you need to execute Load/ Get List method of view. 


Try executing the view method..


Reply