Skip to main content

Hi All,

 

I do understancd that List method returns multiple records and Read returns only a single record in the context of a Sql Smart Object.

 

THis is what I did.

I have an Employee table where emp_id is the PK.

I created a SMO on this table through K2 designer.

Now , instead of using the default Smart Box methods, I went ahead and created an advanced SMO.

In the process of creating the advanced SMO, I created a Read method which returns only sinbgle record by taking in emp_id as input param.

I also added a List method but what I do not understand is , I want to pass only one param as input to the LIST method (say Emp_name) and get all the records as well as all columns (ex: Id , Name , Salary , Role etc.,) corresponding to the passed value of Emp_name. 

 

But LIST method it seems does not allow a single input param.

 

Is this the dfault behaviour of List Method ?

 

Else , How do I pass only employee name ?

 

Attached are screenshots

 

Please advise.

Thanks,

Satya


11409iBF2B7C4924013309.jpg
12583i79B46397916BDA13.jpg

Hi,

 

I don 't see any issue here!

 

the list method you set any parameter as input mapping and it will return all the records that match the parameters you passed, in  your example you are passing TEST as name and the list method will retrieve all the records with name TEST, if you want retrieve only one record you need to use the read method and it will let you pass the employee ID as it's PK and it's guaranteed to retrieve one record as the PK is never duplicated, keep in mind if you want to pass more than one parameter and return one record, you need to create Stored Procedure.

 

Did you try to pass more than one parameter in the list method? ( EMP_Name = Test & EMP_Level = 2)

 

Read method is mostly used in Item Views and list method in list views.


Thanks for replying Mustafa.

 

What I wanted to clarify is :

1>where do we provide input param to a list method?

2>I do no twan to pass more than one param to list method  . How to acheive this ?

3>What exactly happens in Mapping section of th elist method for Input and Output property ?

 

Thansk and Regards,

Satya


Hi,

 

Let's assume I am using a form and I want to use a list method to get data from my DB 

 

I add a rule to execute a smartobject method and here is how i configure it:

 

I can set in the input mapping as many parameters as I want as long as I don't have required properties, you can pass one paramtere if you want.

11200i01AC151F49A1EF7E.pngUsing Input Mappings is critical if a large number of records exist in the backend system. The more records you can filter-out before the results are returned to K2 the better the performance will be.

 

Output mapping is to get the values returned from your list method according to your filter or the inputs.


Reply