I have this ARRAY, but it is triplicating the results. Suggestions are appreciated.
WhileReadingRecords;
Global NumberVar qty;
qty := qty + 1;
Global StringVar serialNumbers;
// split the string into array of lines
Local StringVar Array TempArray := Split( Trim({Job.Note_Text}), Chr(10) );
Local NumberVar i;
Local BooleanVar foundSN := false; // indicates whether we found Serial Number or Heat Code in string
Local StringVar tempString;
For i := 1 To UBound(TempArray) Do
(
tempString := Trim(TempArray);
If foundSN Then
(
If Len(tempString) > 0 Then
(
Local NumberVar pos := InStr(tempString, " ");
If pos > 0 Then
(
serialNumbers := serialNumbers & tempString[1 to pos - 1] & ", ";
serialNumbers := serialNumbers & cdTrimNewLine(Trim(tempString[pos to Len(tempString)])) & "; ";
Exit For;
)
Else
(
serialNumbers := serialNumbers & tempString & "; ";
Exit For;
)
)
)
Else
(
If InStr(tempString, "Serial Number") > 0 Then
(
foundSN := true;
)
)
);
WhileReadingRecords;
Global NumberVar qty;
qty := qty + 1;
Global StringVar serialNumbers;
// split the string into array of lines
Local StringVar Array TempArray := Split( Trim({Job.Note_Text}), Chr(10) );
Local NumberVar i;
Local BooleanVar foundSN := false; // indicates whether we found Serial Number or Heat Code in string
Local StringVar tempString;
For i := 1 To UBound(TempArray) Do
(
tempString := Trim(TempArray);
If foundSN Then
(
If Len(tempString) > 0 Then
(
Local NumberVar pos := InStr(tempString, " ");
If pos > 0 Then
(
serialNumbers := serialNumbers & tempString[1 to pos - 1] & ", ";
serialNumbers := serialNumbers & cdTrimNewLine(Trim(tempString[pos to Len(tempString)])) & "; ";
Exit For;
)
Else
(
serialNumbers := serialNumbers & tempString & "; ";
Exit For;
)
)
)
Else
(
If InStr(tempString, "Serial Number") > 0 Then
(
foundSN := true;
)
)
);