保存数据Orbeon触发器Mysql

时间:2017-03-15 12:51:19

标签: mysql forms orbeon

我在Orbeon中创建了这个简单的表单: img1

我需要从我的表单中保存MySQL数据。 我设置了property.local和server.xml,没问题。

现在,如果我填写表单,请将数据保存在table orbeon_form_data (img)

我创建将表orbeon_form_data中的信息移动到表“formularioBD”:

delimiter |
create trigger form_BD before insert 
    on orbeon_form_data 
    for each row begin
        if new.app = 'prueb3' and new.form = 'formularioBD' then
        delete from formularioBD where id_documento = new.document_id;
        if new.deleted = 'N' and new.draft = 'N' then
            insert into formularioBD set id_documento = new.document_id,
            set texto2 = new.app;
            texto3= 
        end if;
    end if;
end;
|

我可以将表orbeon_form_data移动到表formularioBD,但其他值不会移动。 MySQL的>从formularioBD中选择*;

+------------------------------------------+-------+--------+--------+
| id_documento                             | texto | texto2 | texto3 |
+------------------------------------------+-------+--------+--------+
| 623b3ff9174d0d9fb04e442c1ea786c4ef6f7098 | NULL  | NULL   | NULL   |
| ae86d5f7f39635035c6756c22460c2437d1ae837 |       | NULL   | NULL   |
| b1235abe875adce346eb2e4c2370ab669534c17b |       | NULL   | NULL   |
| a5677881dcda2851d391898b089540b3ef5f308f |       |        | NULL   |
| fa2a25fba728ad5f68bd49c26abcd2f89a61e469 |       | NULL   | NULL   |
| 886955802e5131b201b0e27c8c08560c063087a1 |       | NULL   | NULL   |
| b3cd78d0267547682f191cdf15d8ab6cc97ae12c |       |        |        |
| da1a219c2855390f6e77999572079f466201a830 |       |        |        |
+------------------------------------------+-------+--------+--------+

请帮助。!

问候!

1 个答案:

答案 0 :(得分:0)

谢谢@Avernet 我更新了触发器,现在将数据保存在BD表格中。这是触发器:

delimiter |
create trigger trigger_bd before insert on orbeon_form_data for each row begin
    if new.app = 'prueb3' and new.form = 'formularioBD' then
        delete from formularioBD where id_documento = new.document_id;
        if new.deleted = 'N' and new.draft = 'N' then
            insert into formularioBD set id_documento = new.document_id,
                texto = extractValue(new.xml, '/form/section-1/texto'),
        end if;
    end if;
end;
|

问候!!