Calling an advanced Smartobject method from another Smartobject?

I am using K2 5.4

I have an advanced smartobject, SMO_1, that does at lot of complicated stuff and ends up with a nice list of courses (ID and name).

I have an sql table with some data, one of the fields in the table is the ID of a course.

I would like to show a list of the data from the sql table, but show the name of the course instead of the ID.
How can I do this?

I assume I need to make a composite smartobject, SMO_2, where I get the data from the sql table, and then “join” with the data from SMO_1 on the ID-field, using a service method link.
But I can’t find a way to call SMO_1 from SMO_2. 

Is it possible to do this, and if so how?


Best answer by blap 2 March 2021, 15:48

View original

2 replies

Hi @blap,


I believe that this can be done by using the SmartObject Association feature:
I created 2 advanced SmartObjects (SMO1 and SMO2)

On your second SMO, you can associate it with your first SMO
You need to select a relationship (I used a 1 to 1 relationship here)
I bounded my SMO2 fields to my SMO1 data fields, you will need to play with it a bit to get it working as you want it to, but it is possible. It is dependant on what fields you have in your second SMO though, so for example, if your ID field in your SMO is a Number, then you will have to have a textfield or change it to text to display the name.

Here is a link for more information when working with associations:
How To: Create a SmartObject Association

Hope this helps :)

Kind Regards


Thank you Prineel, that seems to work :)