Update another table through a trigger - triggers

I had summary (view) table come from detail table, I make trigger function on PostgreSQL to capture value in the b_table_summary_view and insert/auto update value into c_table_master . I tried to create this trigger but I did not get the result.
if can't work as well, What you have any option possible to capture value to master table?
Thanks in advance
enter image description here
Error Trigger: update public.c_table_master set public.c_table_master.total_mc=(select public.b_table_summary_view.total_mc from public.b_table_summary_view where code= code)

Related

Change the table's binding

I need to change the binding of my table when i click on a button and it is working when the table is not empty but if the table is empty it is not working
i tried this solution(because the table is already defined in xml) and it is partially working
oTable.bindItems("/CarsSet", oTable.getItems()[0].clone(), null);
the problem is when the table is empty it is not working since oTable.getItems()[0] is undefined
one cheap solution is to clone the first element template and save the reference when the Table has been rendered the first time. After that you can use it when you change the binding otherwise (if the table is empty) you will get that error.
The template item should be defined in the dependents aggregation. This way you can always clone it regardless of the state of the binding.
You can refer to this sample to check how dependents works.

What for using KEY-LISTVAL in item trigger?

I had been working on oracle form 6i for long time and now convert to 12c.
I used not to create item trigger KEY-LISTVAL to handle LOV pop up because the LOV works perfectly as long as the LOV attached to a correct item.
However, some programmers likes to create KEY-LISTVAL to each items which has LOV attached. In the item trigger writes:
list_values;
LOV seems work no different even without this code. Why using this trigger?
Many thanks.
We use it most of the time to create an if statement in the trigger.
If the item is empty select the value with an lov (list_values).
If the item is not empty open another form with the details of the value you selected.
If the KEY-LISTVAL trigger has its "Fire in Enter-Query Mode" property set to "No", this could allow an LOV to be used in data entry mode, but not in query mode.

oracle form ''you cannot update this record''

I have a procedure in which I get values from different tables and calculate a certain decimal number. After that i try to post it on a form text-field which is a database item (update and insert allowed on the settings of block and item). everything works fine but the result wont show on the item and won't save in the database field. I get the error
"you cannot update this record".
Can someone help? i have been working on it for two days now and can't find anything.
Did you check if your user has update access on the table?
Check also if there are database triggers on the table that prevents you from updating the record.

How to apply new changes without dropping current data in the db.(Playframework evaluations)

I'm using play 2.2.1 with scala. And I have a managing database evaluations. When I run my application with changes on the database, it'll drop all my datas.
At this moment evaluationplugin = disabled is comment in. If I comment out, it does not apply my changes.
For example. I have a users table and there are id, f_name, l_name
User
id f_name l_name
1. khazo rasp
And I want to add age field to this table without losing data. I've added this field in scala files.It works properly. I'm assuming I need to write script in 1.sql for some alter command, but I don't want to write script.
How to apply new changes without dropping current data in the db. I've read this documentation. Thanks in advance.
I've added this field in scala files
In slick (you have the tag play-slick), you can specify a default value in your Table
See the documentation here, under Tables:
Default[T](defaultValue: T)
Specify a default value for inserting data the table without this column. This information is only used for creating DDL statements so that the database can fill in the missing information.
I am not sure if it gets translated to ALTER statement if the table already exists . You will have to test it.

SugarCE : How to update a table field based on a changing time condition

I use SugarCE v 6.5.4 . I need to update the status of a database table field based on the
time condition in database table data . Check every 5 minutes for condition and if met Update status of table . How it can done ? please reply me with a solution.
Thanks,
Anes
You can join your suagrcrm DATABASE from the as400 or main tables with directly pass values in the any mySQL database.
Or another way to update manually from IMPORT in PHPMYADMIN.
You should set up a scheduler thats runs every 5min and that does the query and action you want. take a look at http://developers.sugarcrm.com/wordpress/2012/09/07/adding-your-own-reoccuring-jobs-to-the-scheduler/