Skip to main content

Is there a way to create Smart Objects with Read method for tables without primary keys? We use Oracle Service broker and few of our tables have unique indexes but no primary keys. I need to read employee record using a "WHERE" clause or by passing a parameter.


Please refer the attachment. Currently I see al the data from the table. I need to retrieve a single row when I pass Contact Name as a parameter.


Thanks,


Madhuri.

Hi


You can write a custom service object which takes the name as input and returns whatever values you want as a result. If you are looking for no code solution, you can use the list method. This means you have to make sure that only one record is returned. If it returns more than one record then you will only be able to access the last one.


 


 


Thanks much for the reply. Would you happen to have any example for using the list method that returns a single record?


Hi,


Are you using smartforms or ASP or another user interface.


Hi,


I am using Smart forms.


 


Thanks,


Madhuri.


In that case,


Select the 'execute a smartobject method' rule


Select a smartobject


Select smartobject method


Select the 'list' method


In the input page pass in a value for whichever field you want to perform the search on.


In the output page select the return properties from the right and drag it onto whatever field you want.


Hi,


Thank you so much for your response. I tried the solution and it works just fine.


 


Thanks Again!


Hi,


I had one more related question and was hoping if you might have a suggestion for this issue.


Is there a way to insert/update data in oracle tables without primary keys using K2 smartobjects/smartforms?


I have a form that displays employee data. We are displaying the data from oracle tables. Our tables dont have primary keys but have unique indexes. Now, even though we dont have primary keys, I am using list method with input parameters to display a single record based on employee ID. I would like to update data for that record using K2 Smarforms.


When I try to update my smartform, I get the following error.


ORA 00936 : Missing Expression.


I have been researching on this issue and I found that for oracle service broker, All the CRUD (CREATE, READ, UPDATE, DELETE) methods including LIST will only be created as Service Object methods only if there is a primary key on the table. Without a PK, only LIST method will be created.


I was wondering if there is a solution or workaround for this issue.


thanks,


Madhuri.


Hi


Unfortunately, I cannot think of way to solve this without writing some code. You would have to write a custom service which takes the unique indexes and updated fields as an input and then update the tables through code.


 


Hi There,


I was just curious about writing a custom service broker. Do you happen to have any examples for any custom SB? I am specifically looking for some sort of code for defining the properties and all that in a service broker.


 


thanks!


HI


Do you have access to the K2 support site. There is a developers reference which allows you to see how to interact with the K2 API. If not I can show you how to do it.


thanks


Reply