Can anyone help me with a problem with Delphi 1 and Report Smith?
I am trying to pass a variable from an application to Report Smith.
The report is a a form style report which is supposed to print details
from a single record in a table.
The variable in Report Smith is numeric and is called VAR1.
I have set up the following code in my application in the print button
click event:
procedure TMainform.btnPrintClick(Sender: TObject);
var varIndex: INTEGER;
begin
varIndex:=tblValuationsIndex.Value;
Report1.InitialValues.Add('@VAR1=<+varIndex+>');
Report1.run;
end;
In the above tblValuationsIndex.Value represents the field value for
the tables key field.
The problems start in Report Smith, I have tried setting up direct SQL
entry as follows:
SELECT
'VALTNSxDB'.'Index', 'VALTNSxDB'.'Projectdbindex',
'VALTNSxDB'.'Valno', 'VALTNSxDB'.'Valdate', 'VALTNSxDB'.'Workdone',
'VALTNSxDB'.'Material', 'VALTNSxDB'.'Ret', 'VALTNSxDB'.'Prevpay',
'VALTNSxDB'.'Vat', 'VALTNSxDB'.'Claim',
'VALTNSxDB'.'FinalCertificate', 'VALTNSxDB'.'Retpercent'
FROM
'H:\DELPHI\SOURCE\FINANCE\DATA\VALTNS.DB' VALTNSxDB
WHERE
'VALTNS.DB'.'Index' = <<VAR1>>
but I get the error:
"Unexpected end of command. Line Number: 1 Token: + "
I have also tried setting up selection criteria and avoiding editing
the SQL directly (thinking that this would avoid any syntax errors) as
follows:
data field VALTNSxDB.Index is equal to report variable VAR1
this generates the SQL statement:
SELECT
'VALTNSxDB'.'Index', 'VALTNSxDB'.'Projectdbindex',
'VALTNSxDB'.'Valno', 'VALTNSxDB'.'Valdate', 'VALTNSxDB'.'Workdone',
'VALTNSxDB'.'Material', 'VALTNSxDB'.'Ret', 'VALTNSxDB'.'Prevpay',
'VALTNSxDB'.'Vat', 'VALTNSxDB'.'Claim',
'VALTNSxDB'.'FinalCertificate', 'VALTNSxDB'.'Retpercent'
FROM
'H:\DELPHI\SOURCE\FINANCE\DATA\VALTNS.DB' VALTNSxDB
WHERE
((('VALTNSxDB'.'Index' = <<VAR1>>)))
I now receive the error message
"Invalid use of keyword. Line Number: 1 Token: ))) ".
I presume I am making some simple and fundamental mistake but cannot
figure out what it can be.
Thanks.
Donald Cross.