Skip to main content

Hey everyone,


I'm still very new to K2 and am trying to figure out how I'm supposed to be using SmartObjects in an ASP.NET application and take advantage of the relationships between SmartObjects.   


Specifically, I have two SmartObjects, the first is Employee which gets its data using the SQL Server Service), the second is Assignments which is using the SmartBox Service.  Below illustrates the basic relationship between the two.  (I've cut out a lot of fields in the Employee SO for brevity.)   What I want to display in my ASP.NET page is a single table with the combined results, also shown below:


In SQL, this is a very simple INNER JOIN query, how would I go about this using K2 SmartObjects?


Employee: 



  • Full Name
  • Office
  • Employee Number

Assignment: 



  • Assignee's Employee Number
  • Assignment's Employee Number

To be displayed in table:



  • Assignee's Full Name
  • (Hidden) Assignee's Employee Number
  • Assignment's Full Name
  • (Hidden) Assignment's Employee Number

 

Hi gandora,


SmartObjects can be joined using the API or direct execution queries using SQL syntax.


You can have a look at the developer reference for information on how to do this. The K2 blackpearl 4.5 documentation has new documentation and best practises on this which might help you even more.


If you have access to help.k2.com you can follow the links below which links directly to these topics, but they are also included in the product documentation:


Joining SmartObjects: http://help.k2.com/helppages/K2devref/SmartObjects_-_SmartObject_Join.html (Developer Reference: SmartObjects > Best Practices > SmartObject Client API > SmartObjects - SmartObject Join)


Direct Execution: http://help.k2.com/helppages/K2devref/Sample_Direct_Execution_Queries.html (SmartObjects > Best Practices > ADO Provider for SmartObjects > Sample Direct Execution Queries)


Direct execution queries can be used in the ADO provider as well.


Hope this helps!


Reply