Please recheck "separated word" script
Hi , participant and expert,
I try to separated the word in database field . Data in the same field but separated with upper comma (')
For example, In database field name "Description" . There are 2 data . 1) ABCDE'150 2) FGHIJ'190
In fast report I query field "MatrDesc" to Dataset. Then in the " code page" I codeing script by use pascal script as below.
var MatrDesc,descrip,width:string;
function fetch(var value: string; vDelimiter: string): string;
var
idx: integer;
begin
idx := pos(vDelimiter, value);
if idx > 0 then begin
Result := Copy(value, 1, idx-1);
value := Copy(value, idx+length(vDelimiter), Length(Value));
end else begin
Result := value;
value := '';
end;
end;
begin
MatrDesc := (<tbDetail."MatrDesc">);
descrip := fetch(matrdesc, '''');
width := fetch(matrdesc, '''');
end.
But. The result is not show as I need.
The result can separated the word in the field as well , but it always show only one data as below.
FGHIJ 190
FGHIJ 190
Actually, My prefer result should be.
ABCDE 150
FGHIJ 190
Please advise , What's I have mistaken in code ?
Modnoyx
I try to separated the word in database field . Data in the same field but separated with upper comma (')
For example, In database field name "Description" . There are 2 data . 1) ABCDE'150 2) FGHIJ'190
In fast report I query field "MatrDesc" to Dataset. Then in the " code page" I codeing script by use pascal script as below.
var MatrDesc,descrip,width:string;
function fetch(var value: string; vDelimiter: string): string;
var
idx: integer;
begin
idx := pos(vDelimiter, value);
if idx > 0 then begin
Result := Copy(value, 1, idx-1);
value := Copy(value, idx+length(vDelimiter), Length(Value));
end else begin
Result := value;
value := '';
end;
end;
begin
MatrDesc := (<tbDetail."MatrDesc">);
descrip := fetch(matrdesc, '''');
width := fetch(matrdesc, '''');
end.
But. The result is not show as I need.
The result can separated the word in the field as well , but it always show only one data as below.
FGHIJ 190
FGHIJ 190
Actually, My prefer result should be.
ABCDE 150
FGHIJ 190
Please advise , What's I have mistaken in code ?
Modnoyx
Comments
<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->showmessage(MatrDesc); <!--fontc--></span><!--/fontc-->
there and you will see it only happens once.
Put that code
on a MasterData1.OnBeforePrint event and it should be fine, as it will be called for each record in the dataset.
Thank a million , I very appreciated.
Modnoyx