(→Steps) |
(→Steps) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
==Steps== | ==Steps== | ||
Last Script Update : 18 Dec 2015 | |||
:01. Enter below script in the Code Tab | :01. Enter below script in the Code Tab | ||
{| class="mw-collapsible mw-collapsed wikitable" | {| class="mw-collapsible mw-collapsed wikitable" | ||
Line 76: | Line 77: | ||
S.Text := SetStrictDelimiter(<Document_Agent."UDF_AList">); | S.Text := SetStrictDelimiter(<Document_Agent."UDF_AList">); | ||
for I := 0 to S.Count - 1 do begin | for I := 0 to S.Count - 1 do begin | ||
if ValueOfSemiColonStrEx(S[i], 0) = AProject then | if ValueOfSemiColonStrEx(S[i], 0) = AProject then //Same as Project Code CSV Column 1 | ||
Result := ValueOfSemiColonStrEx(S[i], 1); | Result := ValueOfSemiColonStrEx(S[i], 1); //Show CSV Column 2 | ||
end; | end; | ||
finally | finally | ||
Line 85: | Line 86: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
:02. | [[File:FR-GetCSV-01.jpg|800 px|center]] | ||
:02. Click the Red A Icon. | |||
:03. Click on the place to be print/shown. | |||
[[File:FR-GetCSV-02.jpg|800 px|center]] | |||
:04. Enter below Script in the memo | |||
<syntaxhighlight lang="delphi"> | |||
[GetAgentData(<Document_Detail."Project">)] | |||
</syntaxhighlight> | |||
:05. Click Ok button. | |||
:06. Right Click the Memo | |||
[[File:FR-GetCSV-03.jpg|center]] | |||
:07. Select '''Stretch''' | |||
:08. '''File | Save As''' & enter New report Name after done. | |||
==See also== | |||
* [[Report Designer]] | |||
* Others [[Customisation]] |
Latest revision as of 02:31, 20 April 2018
Introduction
Below is example on how to get CSV data from Maintain Agent UDF_AList field
ProjectCode;Remark P12W5;Rmakr 1 P13W4;Note 1234
Steps
Last Script Update : 18 Dec 2015
- 01. Enter below script in the Code Tab
Get CSV Data Script |
---|
function SetStrictDelimiter(const AStr:String):string;
var i, x, ALength : integer;
s, s1 : string;
OrigList, MasterList, Row : TStringList;
begin
OrigList := TStringList.Create;
MasterList := TStringList.Create;
Row := TStringList.Create;
Row.Delimiter := ';';
try
OrigList.Text := RichTextToPlainText(AStr);
for I := 0 to OrigList.Count - 1 do
begin
Row.Clear;
s1 := '';
x := 1;
s := OrigList[I];
ALength := Length(s);
while (x <= ALength) do begin
if x = ALength then begin
s1 := s1 + s[x];
Row.Add(Trim(s1));
end;
if (s[x] = ';') then begin
Row.Add(Trim(s1));
s1 := '';
end else
s1 := s1 + s[x];
inc(x);
end;
MasterList.Add(Row.DelimitedText);
end;
Result := MasterList.Text;
finally
OrigList.Free;
MasterList.Free;
Row.Free;
end;
end;
function ValueOfSemiColonStrEx(const AStr: string; const AIndex: integer): string;
var S: TStringList;
begin
S := TStringList.Create;
try
S.Delimiter := ';';
S.DelimitedText := AStr;
if AIndex < S.Count then Result := S[AIndex]
else Result := '';
finally
S.Free;
end;
end;
function GetAgentData(const AProject:String):String;
var S: TStringList;
i: integer;
begin
S := TStringList.Create;
try
S.Text := SetStrictDelimiter(<Document_Agent."UDF_AList">);
for I := 0 to S.Count - 1 do begin
if ValueOfSemiColonStrEx(S[i], 0) = AProject then //Same as Project Code CSV Column 1
Result := ValueOfSemiColonStrEx(S[i], 1); //Show CSV Column 2
end;
finally
s.Free;
end;
end;
|
- 02. Click the Red A Icon.
- 03. Click on the place to be print/shown.
- 04. Enter below Script in the memo
[GetAgentData(<Document_Detail."Project">)]
- 05. Click Ok button.
- 06. Right Click the Memo
- 07. Select Stretch
- 08. File | Save As & enter New report Name after done.
See also
- Report Designer
- Others Customisation