home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / full / delphi / DELPHI16 / TECHINFO / DELPHI / TIS / TI2824.FX < prev    next >
Encoding:
Text File  |  1995-08-24  |  2.3 KB  |  122 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.   PRODUCT  :  Delphi                                 NUMBER  :  2824
  8.   VERSION  :  All
  9.        OS  :  Windows
  10.      DATE  :  July 14, 1995                            PAGE  :  1/2
  11.  
  12.     TITLE  :  Passing a Variable to a ReportSmith Report
  13.  
  14.  
  15.  
  16.  
  17. The following code demonstrates how to pass variables to a ReportSmith
  18. report.
  19.  
  20. Note: this technical information sheet assumes that you know how to
  21. create a report that includes report variables. For additional
  22. information see chapter four of the ReportSmith manual 'Creating
  23. Reports' that shipped with Delphi.
  24.  
  25. In this case we are assigning a value ('CA') to a string report
  26. variable named 'state'.
  27.  
  28. ReportSmith Code:
  29. This is the info in the ReportVariables Dialog box in ReportSmith.
  30. You can get to this dialog from the reportsmith menu by choosing
  31. Tools | Report Query and pushing the Report Variables button.
  32.  
  33. Name: state
  34. Type: string
  35. Title: state var
  36. Prompt: Enter your favorite state.
  37. Entry: type-in
  38. Report Variables: state ; Note this variable and the value it holds are
  39.                           both case sensitive when passed to ReportSmith.
  40.  
  41. Delphi Code:
  42.  
  43. This code assumes that you have placed a TReport component on your form
  44. named 'Report1' and set the ReportName property to the name of the report
  45. that will be accepting the variable as defined above.
  46.  
  47. Place the following code in the OnClick Method of a pushbutton on your
  48. form.  I use a pushbutton for simplicity, but this code could just as
  49. easily be triggered by any other event.
  50.  
  51.      procedure TForm1.Button1Click(Sender: TObject);
  52.       var s: string;
  53.       begin
  54.           s:='CA';
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.   PRODUCT  :  Delphi                                 NUMBER  :  2824
  69.   VERSION  :  All
  70.        OS  :  Windows
  71.      DATE  :  July 14, 1995                            PAGE  :  2/2
  72.  
  73.     TITLE  :  Passing a Variable to a ReportSmith Report
  74.  
  75.  
  76.  
  77.  
  78.          Report1.InitialValues.Add('@state=<'+s+'>');
  79.            Report1.run;
  80.       end;
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. DISCLAIMER: You have the right to use this technical information
  119. subject to the terms of the No-Nonsense License Statement that
  120. you received with the Borland product to which this information
  121. pertains.
  122.