triggers

onEdit event applicable to only one sheet

妖精的绣舞 提交于 2019-12-25 14:23:13
问题 I'm pretty new to coding. I can get this script to work across all sheets in the document however can't get it to work on just 1 of the sheets. I have looked at similar questions and answers but can't get them to apply to this script :( I have tried to add in if(sheet.getName() == "Delivery Tracking") but then the script won't work at all. function onEdit(event) { var ss = event.source.getActiveSheet(); var r = event.source.getActiveRange(); if(r.getColumn() == 9){ //To check if update cell

Trigger condition in all rows

跟風遠走 提交于 2019-12-25 13:37:07
问题 I'm trying to implement a traffic fine control system. When a radar observation is introduced in the table OBSERVACION the trigger should check if there is a row with an observation over the same car, and then calculate the fine cost. I want a trigger to check a condition statement in every row of the table. I mean, I want the trigger condtion to check all the values in the table and find if one of them is equal to the NEW value introduced. Something like this: WHEN(NEW.fecha_foto = fecha

e.source returns Spreadsheet instead of Form object?

早过忘川 提交于 2019-12-25 13:09:53
问题 I create google form 'on the fly' using data in spreadsheet. Also I install trigger on submit form event. ScriptApp.newTrigger('onSubmit') .forForm(form) .onFormSubmit() .create(); onSubmit function placed in the spreadsheet script because there is no way to point the function on the form's side (I make the copy of existent form with script code but it is no use as I can't make that functions run). Well, I process the submission event on the spreadsheet side. No problem. But when I tried to

e.source returns Spreadsheet instead of Form object?

﹥>﹥吖頭↗ 提交于 2019-12-25 13:09:48
问题 I create google form 'on the fly' using data in spreadsheet. Also I install trigger on submit form event. ScriptApp.newTrigger('onSubmit') .forForm(form) .onFormSubmit() .create(); onSubmit function placed in the spreadsheet script because there is no way to point the function on the form's side (I make the copy of existent form with script code but it is no use as I can't make that functions run). Well, I process the submission event on the spreadsheet side. No problem. But when I tried to

MySql - trigger for keeping min number of rows

旧城冷巷雨未停 提交于 2019-12-25 12:00:31
问题 I want to undo a delete statement if it brings the number of rows below 2000: CREATE TRIGGER Trig1 AFTER DELETE ON Tab1 FOR EACH ROW IF (SELECT COUNT(*) FROM Table1) < 2000 BEGIN INSERT INTO Table1 (select * from old); END; END IF; But it is not working. Can someone tell me what am I doing wrong, and how this should look? 回答1: try, INSERT INTO Table1 SELECT * FROM old point to remember the number of tables and data types must match on both tables since you are using * 回答2: You can try this

SQL Trigger for Insert and Update

我是研究僧i 提交于 2019-12-25 11:16:30
问题 Sql newbie in need of help. I have a table with an SQL trigger that occurs on Insert. It looks like this: ALTER TRIGGER Holiday_ITrig ON HolidayDate FOR INSERT AS IF NOT EXISTS ( SELECT ID FROM WorkingDay w INNER JOIN inserted i ON w.ID = I.WorkingDayId WHERE WorkingDayTypeId = 2 ) BEGIN ROLLBACK TRANSACTION END However, I also need the trigger to fire on update. Is this possible within the same trigger or do I have to create a new 'update' trigger? 回答1: Just add UPDATE to the list of actions

limit field's value with value from another table before write

与世无争的帅哥 提交于 2019-12-25 09:35:03
问题 Are Postgres TRIGGER s transactional by default like (I've read) in MySQL? I've created a TRIGGER procedure that uses a simple IF to limit a column's value with a value from another TABLE with a subsequent UPDATE if the limit is breached. I'd prefer that to be in one single TRANSACTION , but if I wrap the IF ... THEN UPDATE with BEGIN ... COMMIT , it gives error SQL error: ERROR: syntax error at or near ";" LINE 2: BEGIN; ^ Are TRIGGER s TRANSACTION al by default? If not, how can a TRIGGER be

Unusual table table1 is mutating, trigger/function may not see it error in Oracle

喜夏-厌秋 提交于 2019-12-25 09:33:41
问题 I have a trigger like this: (Basically on update of a column in table1, I update a column in table 2) CREATE OR REPLACE TRIGGER AAA AFTER UPDATE ON TABLE_1 REFERENCING NEW AS NEWROW OLD AS OLDROW FOR EACH ROW WHEN ( NEWROW.DELETED ='Y' AND NEWROW.ID IN (41,43) AND OLDROW.DELETED = 'N' ) DECLARE id_1 number; id_2 number; id_3 number; BEGIN select id_1, id_2,id_3 into id_1,id_2,id_3 from table_1 where id_1 = :NEWROW.id1 and id2 = some_other_row.id2; if id_1 is null then update table2 set

Mysql trigger return bad stocks value

試著忘記壹切 提交于 2019-12-25 09:17:33
问题 I need help with my trigger. I have two tables 'product' and 'storage'. The idea is when I run update on column 'flag' in table 'storage' trigger must calculate stock for right ID, but always return the wrong value for all product, please see attach. Right stock value should be for 'Test' 10 pcs and for 'aaaaaa' 5 pcs. Thanks for help. products table: CREATE TABLE `products` ( `id` int(11) NOT NULL, `subcategory_id` int(11) NOT NULL, `product_name` varchar(255) COLLATE utf8_bin NOT NULL,

Why the TargetedTriggerAction's TargetObject is always null

∥☆過路亽.° 提交于 2019-12-25 08:59:42
问题 I have three Buttons (1.Male,2.Femal,3.OK),I want to change the CommandParameters Property of Button(OK) by Click Male Button or FeMale Button . I found the question Setting a property with an EventTrigger is very helpful to me, but the TargetObject of TargetedTriggerAction<FrameworkElement> in void Invoke(object parameter){...} function is always null , WHY ? HOW Can I to solve the Problem? Error info in output window. System.Windows.Data Error: 4 : Cannot find source for binding with