Please bear with me, as I know there have been many posts about RequestForm. To put simply: 1. Customer has related table that contains preferences for variables in a certain recurring report. 2. When user launches report from Customer Card, I want to query those preferences and assign them to variables in the report at the time the request form launches, so that the preferences are filled in prior to printing. User can then accept default preferences and/or change them if desired. 3.The report already has the record filter set for Customer, but since the request form opens prior to OnAfterGetRecord, the Customer is null. How can I get the customer again temporarily when the request form opens, so I can populate preferences? Is this not possible? Thanks
To the best of my knowledge you cannot populate the request form range data from within the object which contains the form. You can only do so from the calling object. There were some recents posts discussing here this.
Hi, I don’t quite know what you are saying here, let me summarize what you are trying to do: when you run the customer card, you want to be able to print out a report when you press a button from the card; the request form of the report pops up with some default preferences. The users will be able to change them if they want to before printing the report. Do I understand your situation? In order to help you, I need to ask you a few questions for you: what is the report that you are trying to run (is it a customized one, or a base one: which is the object number of the report?)? If it is a customized one, what dataitem(s) do the report have? It is feasible to populate the preferences on the request form before you run the report.
Sylvia, Yes you have it correct. It is a custom report for Group Billing customers. The there is a Group Billing Configuration table for each customer containing some runtime preferences such as what columns to show / hide and how to handle some calculations. These same fields are also defined as global variables in the report. So, when printing this report, I would like it if when the request form appears, it has the variables already set to the default configuration for that customer from the aforementioned table.
To continue: I know I can set variables on the RequestForm, but it is a little tricky to get those values from the configuration table because when the form is opened OnAfterGetRecord has yet to fire so I cannot do a GET on the configuration table using the Customer No,
so my question is how can I refer to the customer number on the current customer record BEFORE the OnAfterGetRecord, so I can set these variables on the RequestForm
Devin, I am currently working on your issue. Wondering which version are you using currently, and can you send me a copy of that report, and the customer card? You are right about it being a bit trickly with the variable. I will figure out something.
Create a function on the report and call that function before you call the report? This sounds to obvious to be what you are looking for, but it would look something like (This code is from my head, so it might not be 100% correct): Customer.RESET; Customer.SETRANGE(“No.”,“No.”); CLEAR(BillingReport); BillingReport.SetCustomer(“No.”); BillingReport.SETTABLEVIEW(Customer); BillingReport.RUNMODAL; Then put code in OnInitReport to populate your variables.
Devin, in the customer card define a variable of the type report with the appropriate object ID, e.g. CustReport report 50000 Call the report with the following commands (e.g. using an OnPush trigger of a button) CustReport.SetDefaults(YourParam1,YourParam2); CustReport.run; All you have to do is create a function SetDefaults within your report which initializes variables. Inside this function you can assign the parameters to global variables which you can use later in the request form once the report is run: SetDefaults(YourParam1,YourParam2) GlobalParam1 := YourParam1; GlobalParam2 := YourParam2; As this function is directly connected to your report-object the initialized variables are available once the report is run as long as you don’t clear the object variable after calling the SetDefaults function. That’s it. Torsten