Association of SMO's

  • 16 February 2016
  • 6 replies
  • 2 views

Badge +3

Hi

 

I might be missing the pot totally but I can't seem to get it right. I want to build a single listview of data that has different SmartBox SMO. So I have Orders SMO and a BusinessCard SMO. In SQL I will build a SP with a simple join and get the correct details for the Businesscards. How do I go about that in K2 SmartBox setup?

 

I tried doing Associations by doing joining the Order table to Businesscard or visa versa but I dont see the fields I need.

 

SELECT BusinessCards.NameSurname, BusinessCards.AreYou, BusinessCards.Title, BusinessCards.Qualifications, BusinessCards.MobileNumber, BusinessCards.DirectNumber, BusinessCards.SwitchBoardNumber,
BusinessCards.FaxNumber, BusinessCards.EmailAddress, BusinessCards.AssistantNameSurname, BusinessCards.AssistantDirectNumber, BusinessCards.AssistantFaxNumber,
BusinessCards.AssistantEmailAdress, BusinessCards.Originator, BusinessCards.ConceptAttachment, BusinessCards.TitleOther, BusinessCards.OrderID, Orders.OfficeName, Orders.Address1, Orders.Address2,
Orders.Address3, Orders.Address4, Orders.SpecialInstructions, Orders.OrderDate
FROM BusinessCards INNER JOIN
Orders ON BusinessCards.OrderID = Orders.ID

 

Charl


6 replies

Userlevel 1
Badge +8

Charl

 

It looks like you are on the right track. You should be able to create an association between the Order and Businesscard Smartobjects, joining on the OrderID field in both SmartObjects. Not sure what you mean by you cant see these fields - can you provide some screen shots of when you try and add the association?

Badge +3

Hi Andrew

 

I am doing the association from/on the Orders smo to BusinessCard smo "OrderId" but I am not sure how to retreive the BusinessCard fields in the list. Because I only see the Orders table fields in the listview.

 

 

Thanks

Charl

 

Userlevel 3
Badge +8

Dear ,

 

The SP seems to be ok , could u provide screen shots ? 

1- for the list view in "Edit mode" with right pane expanded on "Fields" , to see the fields returned by the SP ,

2- for the results on runtime , while running the list view .

 

Regards.

Badge +3

HI

 

Hope this helps

 

Created a listview I wanted to see all fields

 

 

17109i4BE32AF5F4D6E9C6.png

 

Thanks

Charl

Userlevel 3
Badge +8

Dear ,  

 

i have a question that i couldnt see from the screen shots , 

could u go to ur list view --> Edit mode , go to General Tab , and check the smartobject used ,

r u sure u r using the StoreProcedure smart object ? or u r using order table smartobject ?

If u were using Order table smartobject  , this will be wrong ,

U will need to create a smartobject based on ur SP ,

u can do that by goin to Tester utility ->> SQL server service --> StoredProcedures 

Generate a smartobject off ur SP , and then u will find it in ur k2 designer , 

then u create a List view off that SP smartobject ,

 

Note : my assmptions based on - > because in the SP u r retrieving 3 columns from order table , and on ur list u get all order table columns (seems that ur list view is based on order SMO itself). 

 

Hope this helps!

Regards.

 

Userlevel 1
Badge +8

Hi Charl

 

It looks like you are on the right track. Once you have created the SmartObject association you should be able to access the fields from the associated SmartObject on your list view. It looks like your List view is using the Order SmartObject as the data source?

 

To add fields from the BusinessCard SmartObject, drag a List Display control onto your list and configure as follows:

 

Field: ID (Order)

SmartObject: BusinessCard

Value: OrderID

Display: [You can choose any property or properties you want from the BusinessCard SmartObject

 

Reply