﻿// new transaction? then read the damage codes from the text file
if not V[mytransactionid=&V[_transactionid]]
  Set V[mytransactionid] "&V[_transactionid]"
  
  // create code table
  CreateTable V[codetable] code text
  
  // reset previous selection
  Clear V[codetable.stat.*] 
  Clear V[codelist]
  
  
  // load content from damage code file
  CopyText fromFile="damagecodes.txt" toText="damagecodes"
  CopyText fromText="damagecodes" toTable=V[codetable] delimiter=";"
  
endif


// display selected codes in list form
InputField	(2,1)	"List of damages"	(2,18) size=35 name="codelist" -readOnly 

// Let the user select multiple values 
Table	(4,1)	(14,53) title="Damage code selection"  name="codetable"  -rowSelection
Column "Code" -readOnly	size=8 name="code" table="codetable"
Column "Text" -readOnly	size=60 name="text" table="codetable"

// selected codes to list field
PushButton	(15,1) "Transfer damage codes to the list"	_
         process="transfer_codes.txt"

// button to remove all selections
PushButton	(15,47)	"@4D@Clear" process="clear_codes.txt"
