How do we retrive POST parameters in rbServer to use in into a RbServer ? I'm using the code from the demo (\Demos\Servers\02. Volume Types\01. Reports in Delphi Forms)
2. For an example of implementing custom parameters see the following article
------------------------------------------------------- Tech Tips: RB Server and Custom Parameters -------------------------------------------------------
The RBServer Custom Parameter demos show how to define custom session and report level parameters that can be used to implement security and other types of custom processing.
The are three projects that work together. Each project includes a ReadMe.doc and commented code.
I've tried to add a parameter on the TrsServer component with the same name as the post parameter, but it doesn't seems to be working.
Here is the definitions in my HTML page:
and i've added in 'Session parameter editor 'testrp' DataTyp: dtString.
Here's my rsServer1GetSessionParameters: procedure TfrmMain.rsServer1GetSessionParameters(Sender: TObject; aParameters: TppParameterList); begin if (aParameters.InList('testrp')) then begin
if (aParameters['testrp'].Value <> '' ) then testRp1 := aParameters['testrp'].Value else testRp1 := 'Empty, but on the list'; end else testRp1 := 'not in the list'; end;
and in the report 'rb001CustomerList' I've added a label and the following code:
procedure Tfrm001CustomerList.ppReport1BeforePrint(Sender: TObject); begin if (frmMain.testRp1 <> '') then ppLblTestRapport.Text := frmMain.testRp1 else ppLblTestRapport.Text := 'no params'; end;
As a first step, work thru the custom parameters demos. The are three projects that work together. Each project includes a ReadMe.doc and commented code.
The custom parameter server demo shows how to define and validate session level and report level parameters. Note that you need to use one of the ReportVolume events to access the session and report parameters that are associated with the report.
Your current approach is not going to work. You can use Report.SessionParameters property to define the session level parameters. Then from the client you need to call GetSessionParameters (as shown in the demos). The OnGetSessionParameters event is optional - it fires in response to the GetSessionParameters call from a client. In your example, I do not know what "testRp1" but you cannot use any external entities from this event nor should you check parameter values - they have not been enetered yet. You should simply use initialize the aParameters[]. The OnValidateSessionParameters can be used to determine whether the parameters are valid - but that is all.
The ReportVolume events can be used to access the parameters associated with the report.
Comments
1. For an example of implementing event-handlers for the ReportModuleVolume
(i.e. forms based reports) download the following
http://www.digital-metaphors.com/tips/ReportModuleVolumEventHandlers.zip
2. For an example of implementing custom parameters see the following
article
-------------------------------------------------------
Tech Tips: RB Server and Custom Parameters
-------------------------------------------------------
The RBServer Custom Parameter demos show how to define custom session and
report level parameters that can be used to implement security and other
types of custom processing.
The are three projects that work together. Each project includes a
ReadMe.doc and commented code.
1. RBServer\Demos\Servers\Custom Parameters
2. RBServer\Demos\WebTier\Custom Parameters
3. RBServer\Demos\Clients\Custom Parameters
The demos include examples of how to...
1. Define Custom Session parameters.
A custom login form is displayed. Based upon the login, the catalog of
reports available to the user is filtered.
2. Define Custom Report parameters
A custom parameter form is displayed. The parameters are used by the report.
3. Custom AutoSearch form
A custom autosearch form is displayed. The parameter values are used by the
autosearch criteria.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
I've tried to add a parameter on the TrsServer component with the same name
as the post parameter, but it doesn't seems to be working.
Here is the definitions in my HTML page:
and i've added in 'Session parameter editor 'testrp' DataTyp: dtString.
Here's my rsServer1GetSessionParameters:
procedure TfrmMain.rsServer1GetSessionParameters(Sender: TObject;
aParameters: TppParameterList);
begin
if (aParameters.InList('testrp')) then
begin
if (aParameters['testrp'].Value <> '' ) then
testRp1 := aParameters['testrp'].Value
else
testRp1 := 'Empty, but on the list';
end
else
testRp1 := 'not in the list';
end;
and in the report 'rb001CustomerList' I've added a label and the following
code:
procedure Tfrm001CustomerList.ppReport1BeforePrint(Sender: TObject);
begin
if (frmMain.testRp1 <> '') then
ppLblTestRapport.Text := frmMain.testRp1
else
ppLblTestRapport.Text := 'no params';
end;
And the label is always shows 'not in the list'.
What's wrong with what i'm doing ?
Thanks alot.
Jean-Fran?ois Picard
As a first step, work thru the custom parameters demos. The are three
projects that work together. Each project includes a ReadMe.doc and
commented code.
The custom parameter server demo shows how to define and validate session
level and report level parameters. Note that you need to use one of the
ReportVolume events to access the session and report parameters that are
associated with the report.
Your current approach is not going to work. You can use
Report.SessionParameters property to define the session level parameters.
Then from the client you need to call GetSessionParameters (as shown in the
demos). The OnGetSessionParameters event is optional - it fires in response
to the GetSessionParameters call from a client. In your example, I do not
know what "testRp1" but you cannot use any external entities from this event
nor should you check parameter values - they have not been enetered yet. You
should simply use initialize the aParameters[]. The
OnValidateSessionParameters can be used to determine whether the parameters
are valid - but that is all.
The ReportVolume events can be used to access the parameters associated with
the report.
--
Nard Moseley
Digital Metaphors Corporation
http://www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com