How to join smart objects

  • 8 December 2014
  • 2 replies
  • 0 views

Badge +1

dears K2 Team,

 

I have two smart objects (Employees And Departments) and i need to make relation between this smart objects by (DepartmentID) field. After that I want to generate some View that show data from both smart objects (Just related data).

 

Please, Can you help me to solve this problem (Please,send full sample for this scenario if you can).Thank you.

 

 

best regards ;

 

BOG Team


2 replies

Badge +10

You can create something called a "composite smartobject". To do this both smartobject must have a list method. You can do this in the K2 designer I believe. Creat a new smartobject and then just map out the joining department fields in the smartobject assocaitions tab

 

Does the information you show have to be on the same line. If it does not have to be on the same line then you can always two views, one for employee and one for deparment and show the employee and then when they click on that employee you get the department Id and then just call the read method or list method and pass that department id to the department smartobject or vice versa.

 

Hope that helps.

Userlevel 4
Badge +13

Hi BOGTeam,


 


Composite SmartObject's are basically two SmartObjects (SmartObject A and SmartObject B) that are combined thus a third SmartObject (SmartObject C) will be generated which provides the ability to extract data from any of the two SmartObjects (SmartObject A or SmartObject B) via the third SmartObject (SmartObject C) which is called the composite SmartObject.


 


Creating a Composite SmartObject via K2 Designer:


http://help.k2.com/kb001304


 


Creating Composite SmartObject via K2 StudioK2 for Visual Studio:


http://community.rightpoint.com/blogs/viewpoint/archive/2012/09/14/build-a-composite-smartobject-in-15-minutes-or-less.aspx


 


Additional Composite SmartObject Resources:


http://www.k2underground.com/blogs/fromthebench/archive/2008/05/06/how-to-generically-iterate-throug...


http://www.k2underground.com/blogs/fromthebench/archive/2008/02/13/composite-smartobject-basics.aspx


 


Kind Regards,


Raymond

Reply