1. Home
  2. /
  3. Docs
  4. /
  5. Articles Report Writer
  6. /
  7. Articles Report Designer ...
  8. /
  9. Common Issues and Solutio...

Common Issues and Solutions

Issue 1: “Undeclared identifier” in Parameter

Error: FDQuery1: Error in expression ‘CANNON’: Undeclared identifier: ‘CANNON’

Cause: Articles is evaluating the parameter value as an expression and getting the wrong data type or value.

Solution: Don’t use the Parameter Editor for dialog values. Set parameters directly in script:

pascal

procedure DialogPage1OnCloseQuery(Sender: TfrxComponent; var CanClose: Boolean);
begin
  qryMain.Close;
  qryMain.ParamByName('CustomerID').Value := DBLookupComboBox1.KeyValue;
  qryMain.Open;
end;

Issue 2: DBLookupComboBox shows blank

Causes:

  1. ListSource not set
  2. KeyField or ListField incorrect
  3. Dataset not opened
  4. No records in dataset

Solution:

pascal

procedure DialogPage1OnShow(Sender: TfrxComponent);
var
  ds: TfrxDataSet;
begin
  // Make sure lookup dataset is open
  qryCustomers.Open;
  
  // Check for data
  ds := DBLookupComboBox1.ListSource.DataSet;
  if not Assigned(ds) then
  begin
    ShowMessage('ListSource not assigned');
    Exit;
  end;
  
  if ds.RecordCount = 0 then
  begin
    ShowMessage('No customers found');
    Exit;
  end;
  
  // Set to first item
  ds.First;
  DBLookupComboBox1.KeyValue := ds.Value[DBLookupComboBox1.KeyField];
end;

Cause: Articles is evaluating the parameter value as an expression and getting the wrong data type or value.

Solution: Don’t use the Parameter Editor for dialog values. Set parameters directly in script:

pascal

procedure DialogPage1OnCloseQuery(Sender: TfrxComponent; var CanClose: Boolean);
begin
  qryMain.Close;
  qryMain.ParamByName('CustomerID').Value := DBLookupComboBox1.KeyValue;
  qryMain.Open;
end;

Issue 2: DBLookupComboBox shows blank

Causes:

  1. ListSource not set
  2. KeyField or ListField incorrect
  3. Dataset not opened
  4. No records in dataset

Solution:

procedure DialogPage1OnShow(Sender: TfrxComponent);
var
  ds: TfrxDataSet;
begin
  // Make sure lookup dataset is open
  qryCustomers.Open;
  
  // Check for data
  ds := DBLookupComboBox1.ListSource.DataSet;
  if not Assigned(ds) then
  begin
    ShowMessage('ListSource not assigned');
    Exit;
  end;
  
  if ds.RecordCount = 0 then
  begin
    ShowMessage('No customers found');
    Exit;
  end;
  
  // Set to first item
  ds.First;
  DBLookupComboBox1.KeyValue := ds.Value[DBLookupComboBox1.KeyField];
end;

Issue 3: Dialog doesn’t showCauses:

  1. Dialog page not set to show automatically
  2. ShowDialog not set to True

Solution:

In the main report page properties:

ReportOptions.ShowDialog = True

Or call it from code:

frxReport.ShowPreparedReport := False;  // Must show dialog first
frxReport.ShowReport;

Issue 4: Query parameters not updating

Problem:

Query still uses old parameter values.

Solution:

Always close and reopen queries when parameters change:

procedure DialogPage1OnCloseQuery(Sender: TfrxComponent; var CanClose: Boolean);
begin
  // MUST close first
  qryMain.Close;
  
  // Set ALL parameters
  qryMain.ParamByName('Param1').Value := Value1;
  qryMain.ParamByName('Param2').Value := Value2;
  
  // Reopen
  qryMain.Open;
  
  CanClose := True;
end;

Issue 5: KeyValue returns display text instead of key

Problem:

DBLookupComboBox1.KeyValue returns “Acme Corp” instead of customer ID.

Cause:

KeyField property is wrong.

Solution:

Double-check your DBLookupComboBox setup:

KeyField: "CustomerID"     <- Must be the ID field
ListField: "CompanyName"   <- The display field