Hello ! can it be changed in the template at the abs edgeband so that only the name of the material appears? I’m using [PARTS.”DEW1NAME”] into template
After selecting the template, select Edit instead of Print. The template editor will open, where you can change the layout of the printout.
The fields are used for printing of the edge bands (the example is for one side): [DEH1NAME] – all informations (name, thickness, code), [DEH1CODE] – code, [DEH1TH] – thickness and [DEH1COLOR] – material or color.
Unfortunately, there is no special field for printing the name of the edge band. But, the name is part of [DEH1NAME].
We will extract the name from the content of the field. We need the part of the text that is in front of the first bracket.
For example, from the text “IP 1 mm( 1 ) IP_3306BS” we need to get “IP 1 mm”.
We will do this using Pascal Script in FastReport.
Here’s the procedure.
1. Our print fields probably have the contents: [PARTS.”DEH1NAME”], [PARTS.”DEH2NAME”], [PARTS.”DEW1NAME”] and [PARTS.”DEW2NAME”].
Delete the contents of the fields, but do not delete the fields themselves. Leave them blank.
2. Change the field names to EB1, EB2, EB3 and EB4. The names are changed in the Property table on the left side of the window.
3. Select the EB1 field, go to “Events” for that field (Left side of the window) and find “OnBeforePrint”, and double-click in the empty section next to it.
Later, it will look like this:
4. The script editor will open. At the top it will say:
procedure EB1OnBeforePrint(Sender: TfrxComponent);
begin
The cursor will be in an empty line after that, and then it will write
end;
Insert the following program code at the cursor position:
fullString := <PARTS."DEH1NAME">;
position: Integer;
if position > 0 then Eb1.Text := Copy(fullString, 1, position - 1)
else Memo24.Text := fullString;
after the line
procedure EB1OnBeforePrint(Sender: TfrxComponent);
add
var
fullString: String;
position: Integer;
The whole procedure must look like this:
procedure EB1OnBeforePrint(Sender: TfrxComponent);
var
fullString: String;
position: Integer;
begin
fullString := <PARTS."DEH1NAME">;
position := Pos('(', fullString);
if position > 0 then EB1.Text := Copy(fullString, 1, position - 1)
else EB1.Text := fullString;
end;
Do not touch
begin
end.
which are at the end.
If you start printing now, the text before the parentheses will be printed at the EB1 field location.
Test before proceeding.
5. For the remaining three fields: EB2, EB3 and EB4, repeat the entire procedure. You will end up with four scripts called:
procedure EB1OnBeforePrint(Sender: TfrxComponent);
procedure EB2OnBeforePrint(Sender: TfrxComponent);
procedure EB3OnBeforePrint(Sender: TfrxComponent);
procedure EB4OnBeforePrint(Sender: TfrxComponent);
Scripts differ only in their name and field name. Instead of EB1.Text it will write EB2.Text, EB3.Text or EB4.Text. Do not forget that each EB field must call its own script in “Events”. Here’s how to view the entire contents of the script window:
procedure EB1OnBeforePrint(Sender: TfrxComponent);
var
fullString: String;
position: Integer;
begin
fullString := <PARTS."DEH1NAME">;
position := Pos('(', fullString);
if position > 0 then EB1.Text := Copy(fullString, 1, position - 1)
else EB1.Text := fullString;
end;
procedure EB2OnBeforePrint(Sender: TfrxComponent);
var
fullString: String;
position: Integer;
begin
fullString := <PARTS."DEH2NAME">;
position := Pos('(', fullString);
if position > 0 then EB2.Text := Copy(fullString, 1, position - 1)
else EB2.Text := fullString;
end;
procedure EB3OnBeforePrint(Sender: TfrxComponent);
var
fullString: String;
position: Integer;
begin
fullString := <PARTS."DEW1NAME">;
position := Pos('(', fullString);
if position > 0 then EB3.Text := Copy(fullString, 1, position - 1)
else EB3.Text := fullString;
end;
procedure EB4OnBeforePrint(Sender: TfrxComponent);
var
fullString: String;
position: Integer;
begin
fullString := <PARTS."DEW2NAME">;
position := Pos('(', fullString);
if position > 0 then EB4.Text := Copy(fullString, 1, position - 1)
else EB4.Text := fullString;
end;
begin
end.
If necessary, check the field names, event names and procedure names again at the end.
I have changed the original answer.
I added new images and changed a few lines of code because there were bugs.
Check the following:
1. Are there fields named EB1, EB2, EB3 and EB4?
If they do not exist, select the field, then go to the properties table, search for “Name” and enter the name EB1.
Repeat this for all names from EB1 to EB4.
2. Also check if fields EB1 to EB4 have the type “Memo” (it has a red letter “A” symbol).
3. Then check if each field has its own BeforePrint event.
4. Finally, check if the script has “EB1” in the name of the procedure and later label names “EB1”.
Thank you so much !! work as i wanted
Hello! first of all I want to thank you for your help..but I think I’m missing something here
I added a link with the uploaded picture
https://postimg.cc/8jw0DDtR