Purpose
You want to clear all GuiXT variables used in a particular transaction when the user starts the transaction.

Solution

  1. Use variables names that start with the transaction code, for example in transaction MM03 you use variable names V[mm03.xxx]
  2. Clear these variables if the system variable &V[_transactionid] changes

Remarks

  • V[_transaction] contains the current transaction code in upper case, e.g. MM03
  • V[_transactionid] contains the current transaction code in upper case, e.g. MM03, followed by a dot and a number 1,2,3... which is increased with each new start of the transaction: MM03.1, MM03.2 and so on


Example

GuiXT Script

// new transaction? then reset variables
 
if not V[mm03.transactionid=&V[_transactionid]]
 
  Clear V[m03.*]
 
  Set V[m03.transactionid] "&V[_transactionid]"
 
endif

 

More general solution

Write an "include" script that clears the variables for the current transaction. You can then include this script into any GuiXT script in which you want to have your variables cleared.

GuiXT Script

include "reset_transaction_variables.txt"

Include script "reset_transaction_variables.txt"

 // current transaction code in lower case
 Set
V[.mytc] "&V[_transaction]" -lowerCase
 
 
// clear variables starting with transaction code + "."
 
if not V[&V[.mytc].transactionid=&V[_transactionid]]
  
Clear V[&V[.mytc].*]
 
   Set V[&V[.mytc].transactionid] "&V[_transactionid]"
 
endif


Components
InputAssistant