Home RAP

Setting Parameter Values

edited March 2009 in RAP
Hi

RB11.03 Enterprise, Delphi 2007

I have a cross report that has a mandatory autosearch criteria that is
linked to a parameter. Due to the size of the data I need to ensure that a
citeria is always entered even when designing the report. I therefore use a
test value which I want to remove when the autosearch dialog is presented.
Historically I have used AutoSearchCriteriaByName.value to set this. Now
that I have a parameter as well I am no longer able to clear the test value
I have set. The user can change the test value to another value but I want
them to see a blank value to start with.

I am using the following rap code but with no success.

procedure ReportBeforeAutoSearchDialogCreate;
begin
Report.AutoSearchCriteriaByName('Usage', 'CustomerNo').Value := '';
Report.Parameters.ItemsByIndex[0].value := '';
Report.Parameters.ItemsByIndex[0].AutoSearchSettings.SearchExpression :=
'';
end;

Anyone have any suggestions how I can remove the test value using code.

Regards

Tim Murfitt

Comments

  • edited March 2009
    Hi Tim,

    My guess would be that this is a timing issue. The AutoSearch Criteria has
    already been created by the time the BeforeAutoSearchDialogCreate event is
    called. Try moving your code to an earlier event such as
    OnInitializeParameters or BeforeOpenDatapipelines

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2009
    Nico

    Tried both of them but still cannot get the criteria to clear. Any other
    suggestions.

    Regards

    Tim

  • edited March 2009
    Hi Tim,

    You are correct. The InitializeParameters event fires too late to assign
    the parameter values however it can be used to assign the search expression
    of an AutoSearch Field. There is a patch available that allows the
    SearchExpression of the Parameter to alter the SearchExpression of the
    AutoSearch Field. This way the following code will work...

    Report.Parameters.ItemsByIndex[0].AutoSearchSettings.SearchExpression := '';

    Please contact support@digital-metaphors.com for the patch.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.