Splitting data found in 1 field into 2 separate fields on a report
Hi
I have been asked if it is possible on a report to have data that is
appearing in 1 field in the table being split into 2 separate fields on a
report.
For Example we have a field that is being entered in the following format
in our program:
CostCentre : Registration_no#cost_centre_ref
on the report we want the registration_no to appear as one field and the
cost_centre_ref to appear in another field.
Is this possible?
Regards
Jamie
--- posted by geoForum on http://delphi.newswhat.com
I have been asked if it is possible on a report to have data that is
appearing in 1 field in the table being split into 2 separate fields on a
report.
For Example we have a field that is being entered in the following format
in our program:
CostCentre : Registration_no#cost_centre_ref
on the report we want the registration_no to appear as one field and the
cost_centre_ref to appear in another field.
Is this possible?
Regards
Jamie
--- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.
Comments
Inside the DetailBand.BeforePrint you could separate the field into two
strings, then assign each one to a TppLabel placed inside that band.
Something like the following psudo code...
procedure Form.DetailBand1BeforePrint(Sender: TObject);
var
liSeparatorPos: Integer;
lsFieldValue: String;
lsRegistrationNo: String;
lsCostCenterRef: String;
begin
lsFieldValue := Report.DataPipeline['MyField'];
liSeparatorPos := Pos('#', lsFieldValue);
lsRegistrationNo := Copy(lsFieldValue, 1, liSeparatorPos - 1);
lsCostCenterRef := Copy(lsFieldValue, liSeparatorPos + 1,
Length(lsFieldValue));
Label1.Caption := lsRegistrationNo;
Label2.Caption := lsCostCenterRef;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com