Table of Content
HAL Forum
function boolean BuildRDBData (
string RegisterName)
Description:
Inserts records from specified register into relational database (if it has been set up correctly). Returns false if an error occurs
Parameters:
RegisterName The name of the register identificator for which we are building the RDB data for.
global
updating procedure RDBDoBuildData(LongInt rwn)
begin
  Integer i,rwcnt;
  record RDBRegsBlock RDBr;
  row RDBRegsBlock RDBrw;
  row RDBRegsBlock RDBrw2;
  
  BlockLoad(RDBr);
  
  MatRowGet(RDBr,rwn,RDBrw);
  
  if (RDBrw.Valid==0) then begin
    if (BuildRDBData(RDBrw.RegCode)==false) then begin
      StopAlert("Error building RDB Data");
      goto out;
    end;
  end else begin
    StopAlert("RDB Data must be cleared first");
    goto out;
  end;
  
  BlockLoad(RDBr);
  rwcnt = MatRowCnt(RDBr);
  for (i = 0; i<rwcnt; i = i + 1) begin
    MatRowGet(RDBr,i,RDBrw2);
    if (RDBrw.RegCode==RDBrw2.RegCode) then begin
      goto updrow;
    end;
  end;
  
  goto out;
  
updrow:;
  RDBrw2.Valid = 1;
  MatRowPut(RDBr,i,RDBrw2);
  BlockStore(RDBr);
  
out:;
  return;
end;

Related topics:
««