Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3441

How to get the last inserted row in DB exposed via ODATA

$
0
0

I am trying to make an application that will update the UI with the row that was last inserted in DB. The data model is exposed via ODATA and any insertion in DB is independent of my UI app.

Suppose the ODATA entity set name is MySet and has fields: id, name, country.

 


As soon as any new row is inserted in database, I want the value of 'country' field to be shown in UI only if /MySet/name = '<comes from variable>'.


I am unable to figure out how to provide the bindings with $filter and $top options.



The solution that I have in my mind are:

1. Create a binding till /MySet and attach onChange (or onDataInserted) listener. In onChange listener make an odata read() call with the desired filters. But is there no way to get inserted data instead of making additional 'read' calls every time.

2. Create a view where 'MySet.Name' is the primary key. Now create a trigger in DB that will update the values in this view.


Thanks!!



Viewing all articles
Browse latest Browse all 3441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>