﻿// Clear variables
Set V[k] 0
Set V[line] ""
clear text[result]

// Read status fields
Set V[line] "Database: &V[_database]"
copytext fromstring="line" totext="result"  -appendline

Set V[line] "Client: &V[_client]"
copytext fromstring="line" totext="result"  -appendline

Set V[line] "Transaction: &V[_transaction]"
copytext fromstring="line" totext="result"  -appendline

Set V[line] "Username: &V[_user]"
copytext fromstring="line" totext="result"  -appendline

Set V[line] "Title: &V[_title]"
copytext fromstring="line" totext="result"  -appendline


// Read fields and values from current screen
label nextfield

Set V[k] "&V[k]" + 1

GetFieldattribute #[&V[k]] text=label techname=techname

if q[ok] and V[label] and V[techname]
  Set V[line] "&V[label]: &F[&V[techname]]"
  copytext fromstring="line" totext="result"  -appendline
  goto nextfield
endif

// Put the output into the clipboard
// -> user can paste it somewhere
copytext fromtext="result" -toclipboard

// Set output field to visible
set V[screen_report_visible] "X"

