How to load sql view as editable list k2?

  • 1 March 2021
  • 4 replies
  • 10 views

I have loaded a sql view into the k2, but I can only load it as a smartobject and then make a list.

How could I load an sql view to later have an editable list in k2?


4 replies

Hi @ericas,

 

From what I understand, It only gives you the list method when creating an advanced smartobject, instead of all of the methods (create, read, update, delete and list). The most common reason this happens is because there are no primary keys in the SQL tables which is required to make use of all K2 methods. Please make sure that your tables/views in SQL, have primary keys (something like an ID value would be a primary key). I will attach a useful PDF document as well as the following useful link:
https://www.w3schools.com/sql/sql_primarykey.ASP

Hope this helps :)

 

Kind Regards

Prineel

 

 

I do not think it is a failure of primaries since the view has a primary.

Hi @ericas,

 

Is the “IdUsuario” field the primary key in your SQL table (if im not mistaken, sql views are derived or made from tables)? If possible, please send screenshots of your sql table and view.

 

Kind Regards

Prineel

Userlevel 5
Badge +13

If it is a SQL View, then the data is inherently read-only, so K2 can only show the data from the view. You can add an “Update” method manually, but it would likely have to an underlying table directly. If the view has been defined as editable, then if you could show a screenshot of what the “Add Method” dialog looks like when you select your view that would be very helpful.

Reply