【问题标题】:How to update tables in fields after amending existing information修改现有信息后如何更新字段中的表格
【发布时间】:2022-11-02 16:55:15
【问题描述】:

我目前需要添加到每次用户单击更新其任何信息的程序上的“保存”按钮时更新的表。 当任何字段被修改时,为了我们有更改日志,我需要在“slinfo”表上创建一条记录,包括:

Customer name (slinfo.name)
Customer account (slinfo.acode)
The date      (slinfo.date)
And slinfo.seq, which is the sequence number for each change.

我将如何去做这样的事情?

【问题讨论】:

    标签: openedge progress-4gl


    【解决方案1】:
    /* presumably you already have a save trigger to save the amended values
     * this code should go in that trigger, probably at the end
     */
    
    /* I, obviously, have no way to know where the actual values for
     * these variables are supposed to come from. if the logic for
     * that is simple enough you might even be able to eliminate the variables
     */
    
    define variable nameVariable as character no-undo.
    define variable acodeVariable as character no-undo. /* I'm guessing that this is a character field */
    define variable seqVariable as integer no-undo.
    
    /* do something to populate the variables...
     */
    
    /* since you are apparently already saving changes to slinfo
     * you just need to add a few fields
     */
    
    assign
      slinfo.name  = nameVariable
      slinfo.acode = acodeVariable
      slinfo.date  = today
      slinfo.seq   = seqVariable
    .
    

    【讨论】:

      【解决方案2】:

      你可以用数据库触发器https://documentation.progress.com/output/ua/OpenEdge_latest/pdsoe/PLUGINS_ROOT/com.openedge.pdt.langref.help/rfi1424920170039.html

      您可以访问 trigger also 语句中的旧字段值和新字段值

      简单的写程序:

      CREATE slinfo.
      ASSIGN
       slinfo.name  = Customer.NAME
       slinfo.acode = Customer.account 
       slinfo.date  = TODAY
       slinfo.seq   = NEXT-VALUE(seqSlinfo)
      

      .

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-03-17
        • 2021-10-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-23
        相关资源
        最近更新 更多