Problems with a Trigger on a field

volley44

New Member
Hi all !

I'm new at this and I started using Progress last week !
My first task is to put a trigger on a field and have two actions completed with that trigger:
1. update two fields with data from an another table.
2. update a calculated field with data from the current table and another table.

My biggest challenge is... I noticed that everytime I leave that field, the trigger is executed (that's good) but all the new data that I just put in is gone ?? (that's bad !)

Could anyone help me out !
We are using Progress 9.1c and Syteline 6.

Thanks in advance for your help !

France Moris-7
Quebec, Canada
 

smithxxl

New Member
By default each widget can have 2 value... a variable value and a screen value. When you set the variable value and then use a display and update statement, the variable value is usually copied to the screen value.

The screen value needs to update the variable value. You can do that manually by two ways. Take a look at the following example:

Code:
DEF VAR xVar1  AS CHAR NO-UNDO.
DEF VAR xVar2  AS INTE NO-UNDO.
DEF VAR tbVar3 AS LOGI NO-UNDO
  VIEW-AS TOGGLE-BOX.

DEF BUTTON btBad   LABEL "Bad Way".
DEF BUTTON btGood  LABEL "Good Way".
DEF BUTTON btOther LABEL "Other Way".

FORM
  xVar1 LABEL "String"  AT ROW 1.5 COL 2
  xVar2 LABEL "Integer" AT ROW 2.5 COL 2
  tbVar3 LABEL "Check Box" AT ROW 3.5 COL 2

  btBad AT ROW 5 COL 2
    SPACE(0)
  btGood
    SPACE(0)
  btOther
    SPACE(1)
    SKIP(1)
  WITH SIDE-LABEL THREE-D VIEW-AS DIALOG-BOX TITLE "Test Screen Values" FRAME frTest.

ON WINDOW-CLOSE OF FRAME frTest
  APPLY "End-ERROR".
ON CHOOSE OF btBad
  DO:
    MESSAGE xVar1 SKIP xVar2 SKIP tbVar3
      VIEW-AS ALERT-BOX INFO TITLE "Bad Way".
  END.
ON CHOOSE OF btGood
  DO:
    ASSIGN xVar1 xVar2 tbVar3.

    MESSAGE xVar1 SKIP xVar2 SKIP tbVar3
      VIEW-AS ALERT-BOX INFO TITLE "Good Way".
  END.
ON CHOOSE OF btOther
  DO:
    ASSIGN
      xVar1 = xVar1:SCREEN-VALUE
      xVar2 = INTE(xVar2:SCREEN-VALUE)
      tbVar3 = tbVar3:CHECKED.

    MESSAGE xVar1 SKIP xVar2 SKIP tbVar3
      VIEW-AS ALERT-BOX INFO TITLE "Other Way".
  END.

REPEAT:
  UPDATE xVar1 xVar2 tbVar3 btBad btGood btOther WITH FRAME frTest.
  LEAVE.
END.

It's usually better to do the example with btGood. The btOther example is just showing you what there are 2 values available. Also SCREEN-VALUE returns a character and when using a saving the SCREEN-VALUE value to an integer variable, you would have to put the INTE() function around it. When an GO is applied to an UPDATE statement, all screen values for fields updated in the statement are saved to the variable. Play around with the sample by changing values, then click a button. Repeat change values and then click the another button.
 

volley44

New Member
Tks !

Hi ! and Thanks !

I don't have the chance to try it today but I most certainly will tomorrow !
The way I understand it, with the action I'm taking I need to update my fields before doing anything else ?! Cause if I don't I lose my changes !

Thanks again !

France Moris-7
Quebec, Canada
 
Top