1. Erik Segerdell
  2. Valentina Studio
  3. 水, 4月 24 2019, 11:16 PM
  4.  メールで購読
I'd like to be able to edit data in a view shown in a form TableView. Right now it seems that a view can only be read-only. In the toy example in Screen Shot 1, the "Observations" view was set up with the following in a PostgreSQL database:


CREATE VIEW observations_for_plate AS
SELECT observation.observation_id AS "Observation ID",
observation.plate_id AS "Plate ID",
observation.date AS "Date",
observation.alive AS "Alive",
observation.dead AS "Dead",
observation.censor AS "Censor"
FROM observation
ORDER BY observation.plate_id, observation.date;


For example, I'd like to change the data in the Dead column in the third row to "2". I know this can be done with the SQL:

UPDATE observations_for_plate SET "Dead"=2 WHERE "Observation ID"=20000040;

But I'd like to be able to do the same thing using the form.

Further, it would be desirable to do the same thing but within a more complex view (Screen Shot 2) like the following:


CREATE VIEW observations_for_plate AS
SELECT observation.observation_id AS "Observation ID",
observation.plate_id AS "Plate ID",
observation.date AS "Date",
observation.alive AS "Alive",
observation.dead AS "Dead",
observation.censor AS "Censor",
tech.tech_name AS "Tech Name"
FROM observation
LEFT JOIN tech ON observation.tech_id=tech.tech_id
ORDER BY observation.plate_id, observation.date;


However, in Postgres it seems that the same UPDATE statement doesn't work when the view selects from more than one table, and that a trigger or rule needs to be set up to do an update. But it would be great to be able to use the form to edit/update the data in this circumstance.

Thanks!
添付ファイル
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Hello Erik,

Yes, I think we can support these two cases.
In the second case it is necessary to generate an ordinary UPDATE for the source table of the view:

UPDATE observation SET dead=2 WHERE observation_id =20000040;

Right?
コメント
There are no comments made yet.
Erik Segerdell 承諾済みの回答
Yes, that's right.
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Hello Erik,

This feature will be available in version 9.2.
コメント
There are no comments made yet.
Sergey Pashkov 承諾済みの回答
Hello Erik,

A new version is available for download.
コメント
There are no comments made yet.
Erik Segerdell 承諾済みの回答
Thank you!
コメント
There are no comments made yet.
  • ページ :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories