Table of Content
HAL Forum
function boolean ValidRegisterCode (
string RegisterCode)
Description:
Checks if specified register code is not defined in the system. Returns FALSE if register not found.
Parameters:
RegisterCode The code of the register that was used when defining it with RecordBegin
global
updating procedure RDBDoAddRegister()
begin
  Integer wn,mwn,i,rwcnt;
  record RcVc RepSpec;
  record RDBRegsBlock RDBr;
  row RDBRegsBlock RDBrw;
  
  wn = CurWindow;
  DeselectWindow(wn,true);
  
  mwn = MotherWindow(wn);
  
  GetWindowRecord(wn,RepSpec);
  BlockLoad(RDBr);
  
  if (ValidRegisterCode(RepSpec.f1)==false) then begin
    StopAlert("Not a valid register: " & RepSpec.f1);
    goto out;
  end;
  
  rwcnt = MatRowCnt(RDBr);
  for (i = 0; i<rwcnt; i = i + 1) begin
    MatRowGet(RDBr,i,RDBrw);
    if (RDBrw.RegCode==RepSpec.f1) then begin
      StopAlert("Register already included: " & RepSpec.f1);
      goto out;
    end;
  end;
  
  RDBrw.RegCode = RepSpec.f1;
  RDBrw.Valid = 0;
  MatRowPut(RDBr,rwcnt,RDBrw);
  BlockStore(RDBr);
  PutWindowRecord(mwn,RDBr);
  
out:;
  CloseWindow(wn);
  return;
end;
Related topics:
««