assign a variableand filter a report from a form

Hi, I want to pass a filtered record, AND set a variable in a report, from a form. Can someone tell me how i can do this ? Ziad

You could create a function within the report which is receiving the variable and record as parameters: Your Report - Globals: VarRecord_Gbl, Type Record VarRecord_Gbl, Type … Your Report - New Function: Def(VAR VarRecord_Lcl, VarVariable_Lcl) VarRecord_Gbl := VarRecord_Lcl; VarRecord_Gbl := VarVariable_Lcl; Now you could use the record/variable for whatever purpose within the report. From your Form you could call the report like this: Your Form - Globals: MyRecord, Type Record MyVariable, Type … YourReport, Type Report Your Form - WhateverTriggersTheReport: YourReport.Def(MyRecord, MyVariable); YourReport.RUNMODAL; Hope this helps a little.

Thanks, there is one more problem, i know that if you use the “REPORT.RUNMODAL” i can control printing/preview… I want to print directly i dont want to go through the report form how can this be done?

From C/SIDE Reference:


USEREQUESTFORM (Dataport & Report) Use this function to return the current setting of the UseReqForm property, and to set this property to a new value. [IsUseRequestForm] := USEREQUESTFORM([SetUseRequestForm]) IsUseRequestForm Data type: boolean The current setting of UseReqForm SetUseRequestForm Data type: boolean The new setting of UseReqForm. Comments This function should be used before the request form is run - that is, in the OnInitReport trigger. Although it will not cause an error if it is used elsewhere, it will have no effect. See the description of the UseReqForm property for details.

So in my previous example it would be like this: Your Form - WhateverTriggersTheReport: YourReport.Def(MyRecord, MyVariable); YourRepoprt.USEREQUESTFORM(FALSE); YourReport.RUNMODAL;

Joerg’s suggestion will always “print” the report. The only way I found to define the preview/print from outside the report, passing that info is parameter is using SendKeys and the OnTimer trigger of the Request Form. Not very nice solution but works. Let me know, if you want me to elaborate a bit more. Saludos Nils

Thanks for all the replies. works like a charm. I would love to hear more Nilsm, though the solotion i need is to directly print. Thanks