Order of events
I'm new to using FastReports, so this may have a simple solution that I just haven't found.
I have a report that prints a list of phone log entries. The possibilities are, calls from agent, calls to customer, and calls from agent to customer. I use a TfrxUserDataSet to supply the data to the field, and use a single field to supply either the agent name or customer name, controlled by my application. I have one TfrxMemoView on the report tied to this field. If the field has a value in it, I need that field to display, which is the default view. However, if the report is an "agent to customer" reports, my application supplies an empty string to the field. If the field is an empty string, I need to hide the MemoView and shift the remaining fields on the report to the left to fill in the gap. The following is my event handler for the OnBeforePrint of the MasterBand (Cust_AcctMgr is a variable linked to the name field).
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if (<Cust_AcctMgr> = '') then
begin
LogListDataLogName.Visible := false;
LogListDataLogSubject.Left := 10.26;
LogListDataLogSubject.Width := 3.5;
LogListDataLogNotes.Left := 14.76
LogListDataLogNotes.Width := 12.0;
end
else
begin
LogListDataLogName.Visible := True;
LogListDataLogSubject.Left := 14.26;
LogListDataLogSubject.Width := 3.0;
LogListDataLogNotes.Left := 17.26
LogListDataLogNotes.Width := 8.5;
end;
end;
The problem is, when I load the report for an "agent to customer" log, nothing changes on the report. The MemoText is still visible, and nothing moves to the left. It appears as if the event is never fired, or that the name field is always empty when the event fires.
My question is, are the data fields of the TfrxUserDataSet populated before or after the OnBeforePrint event is fired for a report's band? If not, then checking a field's value is worthless in the OnBeforePrint event. Is there a way to tell if my event is even being executed?
Any help will be greatly appreciated. Thanks.
I have a report that prints a list of phone log entries. The possibilities are, calls from agent, calls to customer, and calls from agent to customer. I use a TfrxUserDataSet to supply the data to the field, and use a single field to supply either the agent name or customer name, controlled by my application. I have one TfrxMemoView on the report tied to this field. If the field has a value in it, I need that field to display, which is the default view. However, if the report is an "agent to customer" reports, my application supplies an empty string to the field. If the field is an empty string, I need to hide the MemoView and shift the remaining fields on the report to the left to fill in the gap. The following is my event handler for the OnBeforePrint of the MasterBand (Cust_AcctMgr is a variable linked to the name field).
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if (<Cust_AcctMgr> = '') then
begin
LogListDataLogName.Visible := false;
LogListDataLogSubject.Left := 10.26;
LogListDataLogSubject.Width := 3.5;
LogListDataLogNotes.Left := 14.76
LogListDataLogNotes.Width := 12.0;
end
else
begin
LogListDataLogName.Visible := True;
LogListDataLogSubject.Left := 14.26;
LogListDataLogSubject.Width := 3.0;
LogListDataLogNotes.Left := 17.26
LogListDataLogNotes.Width := 8.5;
end;
end;
The problem is, when I load the report for an "agent to customer" log, nothing changes on the report. The MemoText is still visible, and nothing moves to the left. It appears as if the event is never fired, or that the name field is always empty when the event fires.
My question is, are the data fields of the TfrxUserDataSet populated before or after the OnBeforePrint event is fired for a report's band? If not, then checking a field's value is worthless in the OnBeforePrint event. Is there a way to tell if my event is even being executed?
Any help will be greatly appreciated. Thanks.
Comments
objects are processed top down depending on band type
and left to right in order of creation, possitional properties are in pixels
I'm used to using breakpoints in my Delphi code when something is not working the way I expect, but there doesn't seem to be a way to do the same in my script, so I have no way of finding out if the event is even being fired.
Since I am under a time constraint, I don't have a lot of time to work through this problem, so for now I decided to create a second report identical to the first, but with the indicated MemoText removed and the other fields modified. I let my Delphi code decide which report to show. Because the forms are essentially identical, they can both use the same userdataset, so my code is kept to a minimum.
When I get the chance, I will look more closely at this.
Thanks for working with me on this.