1. Erik Segerdell
  2. Valentina Studio
  3. Donnerstag, März 28 2019, 11:07 PM
  4.  Abonnieren via E-Mail
Is there a way to automatically refresh views of related records in a form, after a new related record has been added? For example in Screen Shot 1, the "Strains" table at the upper right is a View of records related to the current Individual Experiment ("testexp1";). We can add a new record using the import mechanism, and the new row can seen in the same table in Screen Shot 2. However, this view does not refresh right after adding the record. The new row does not appear unless you click the ">" button to go to the next Individual Experiment, then click "<" to go back to testexp1 (or unless you close and re-open the form). We've tried to add a button with the action "View --> Reload records" but this does not work.

Thanks!
Anhänge
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Thank you,
to update the TableView based on a View you can use the following method:
this.TableViewName.reload()
Kommentar
There are no comments made yet.
Erik Segerdell Akzeptierte Antwort
The "All Compounds" TableView is based explicitly on a view, not on a table. Here is the query used to create the view:


SELECT all_compounds_table.comp_id AS "Compound ID",
all_compounds_table.comp_name AS "Compound",
all_compounds_table.comp_abbr AS "Abbreviation",
compound_controls_table.control_name AS "Control"
FROM (all_compounds_table
LEFT JOIN compound_controls_table ON ((all_compounds_table.control_id = compound_controls_table.control_id)))
ORDER BY all_compounds_table.comp_id;


We are using a PostgreSQL database.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Is "All Compounds" TableView based on a table, and not on a view or query?
Also, what database is used?
Kommentar
There are no comments made yet.
Erik Segerdell Akzeptierte Antwort
I should add that this is also the case when the view isn't mapped -- e.g., here is a new screen shot that is similar to the previous ones, except that the view underneath "All Compounds" contains all records rather than related ones. When a new Compound is added, the view does not refresh unless the form is closed and re-opened.
Anhänge
Kommentar
There are no comments made yet.
Erik Segerdell Akzeptierte Antwort
That's correct.
Kommentar
There are no comments made yet.
Sergey Pashkov Akzeptierte Antwort
Hello Erik,

Please specify - how do you add a new record? Using the form for a related table with "Add" data mode?
Kommentar
There are no comments made yet.
  • Seite :
  • 1


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