In an earlier step, the quick entry forms of a Uniface 10 customer app got drafts. In those forms the user types every row, so loading a draft means creating the rows again. The goods receipt, delivery note and ticket forms are different: their rows come from the database (open purchase order lines, open order lines, open tickets), and the user only fills in a few columns. A draft for those forms has to keep the rows the database provides and only put the user's input back.
Tested with Rocket Uniface 10.4.03 Community Edition (10.4.03.021) on Windows, SQLite 3.50.2 via the SLE driver, November 2026.
What the draft file contains
The format is the same as before, one value per line, 0 for the header:
#draft 17.11.2026 13:14
0|F_PO|TS41-P1
0|F_WH|T41A
0|F_DATE|
1|L_LINE|4100001
1|L_QTY|6
2|L_LINE|4100002
2|L_QTY|3
Only rows with a quantity are written, and each row carries its key, the purchase order line ID.
Header first, through the normal entries
The header values are not just copied into the fields. Each one is set and then the same entry runs that runs when the user leaves the field. LEAVE_PO finds the order and loads its open lines, LEAVE_WH checks the warehouse:
entry DRAFT_HEADER
params
string pHead : IN
endparams
variables
string vV
endvariables
vV = ""
getitem/id vV, pHead, "F_PO"
F_PO.QRC_HDR = vV
call LEAVE_PO
vV = ""
getitem/id vV, pHead, "F_WH"
F_WH.QRC_HDR = vV
call LEAVE_WH
vV = ""
getitem/id vV, pHead, "F_DATE"
F_DATE.QRC_HDR = vV
call LEAVE_DATE
return 0
end
The order matters: the purchase order loads the rows, so it comes first.
Rows by key, not by position
Since the open lines were just reloaded, their positions may differ from the time the draft was saved, and lines may already be fully received. Each saved row is looked up by its line ID, the value is set, and the normal row check runs:
entry DRAFT_ROW
params
string pVals : IN
numeric pFound : OUT
endparams
variables
string vKey, vV
numeric vI, vN
endvariables
pFound = 0
vKey = ""
getitem/id vKey, pVals, "L_LINE"
if (vKey = "")
return 0
endif
vN = $totocc(QRC_LIN)
vI = 1
while (vI <= vN & pFound = 0)
setocc "QRC_LIN", vI
if (L_LINE.QRC_LIN = vKey)
pFound = vI
endif
vI = vI + 1
endwhile
if (pFound = 0)
return 0
endif
vV = ""
getitem/id vV, pVals, "L_QTY"
L_QTY.QRC_LIN = vV
call CHECK_ROW
return 0
end
The caller counts pFound = 0, and the form says "2 row(s), 1 row(s) are no longer open" instead of dropping input without a word.
The values are collected per row: one id list (putitem/id) per saved row, handed to DRAFT_ROW when the row number in the file changes. A single id list for all rows would not work, because row 2 would overwrite the L_QTY of row 1.
Reading the app's own CSV exports
The forms can export their rows as CSV with ; and quoted values. To let users edit such a file in a spreadsheet and load it again, the service needs to split a CSV line correctly - a product name like TS41 nut; small arrives in quotes. ProcScript has no CSV parser, so here is a small one that walks the line character by character. The quote character comes from SQL because a double quote cannot be written inside a ProcScript string literal:
public operation CSV_SPLIT
params
string pLine : IN
string pValues : OUT
endparams
variables
string vQ, vC, vCur, vNext
numeric vI, vN, vIn, vJ
endvariables
pValues = ""
call GET_TEXT("SELECT char(34) AS Q", vQ)
vCur = ""
vIn = 0
vN = $length(pLine)
vI = 1
while (vI <= vN)
vC = pLine[vI:1]
if (vIn = 1)
if (vC = vQ)
vJ = vI + 1
vNext = ""
if (vJ <= vN)
vNext = pLine[vJ:1]
endif
if (vNext = vQ)
vCur = $concat(vCur, vQ)
vI = vI + 1
else
vIn = 0
endif
else
vCur = $concat(vCur, vC)
endif
else
if (vC = vQ)
vIn = 1
elseif (vC = ";")
putitem pValues, -1, vCur
vCur = ""
else
vCur = $concat(vCur, vC)
endif
endif
vI = vI + 1
endwhile
putitem pValues, -1, vCur
return 0
end
The load operation reads the header line, looks for a column named Article and a quantity column (Quantity, Counted or quantity, Receive now), and turns every data line into ARTICLE QUANTITY. That text then goes through the same parser as pasted lists. Files without such a header are passed through as a plain list.
Inside the service, CSV_SPLIT is a public operation, so the load operation runs it with activate $instancename.CSV_SPLIT(vLine, vValues). A plain call is for entries.
Testing
A self-checking service covers the splitter (simple line, quotes and separators inside values, empty values in place), reading an exported purchase order list and a stock list, a plain list, a missing file, a file with only a header, and read-only rights. The forms were clicked through on a copy of the database: a goods receipt draft restored onto reloaded order lines, a CSV with a quoted name containing ;, and a purchase order export loaded back in.
Summary
- For drafts over database rows, replay the header through the normal leave entries, then lay the saved values onto rows found by key.
- Keep one id list per saved row.
- Report rows that no longer exist instead of dropping them.
- A character loop is enough for a CSV splitter; get the quote character from SQL.
Top comments (0)