Applies To:
  • CitectSCADA v7.0, v7.1

Summary:
I am trying to use the _CSV_MM_GetArgument(STRING sAction) which is in the csv include project.

The function seems not to be correct.

STRING
FUNCTION
_CSV_MM_GetArgument(STRING sAction)

STRING sActionTmp;
STRING sArgument;
STRING sArguments;
INT iCommaPos;
INT iOffset;
INT iLength;

sActionTmp = sAction;
StrWord(sActionTmp);

WHILE iCommaPos > -1 DO
iCommaPos = StrSearch(iOffset, sActionTmp, ",");

IF iCommaPos > -1 THEN
iLength = iCommaPos - iOffset;

ELSE
iLength = StrLength(sActionTmp) - iOffset;
END

IF iLength > 0 THEN
sArgument = StrTrim(StrMid(sActionTmp, iOffset,
iLength));
ELSE
sArgument = "";
END

iOffset = iCommaPos + 1;

sArguments = sArguments + sArgument + ",";

END

IF sArguments <> "" THEN
sArguments = StrLeft(sArguments, StrLength(sArguments) - 1);
END

sArguments = "^"" + CSV_String_Replace(sActionTmp, ",", "^",^"") +
"^"";
RETURN sArguments;

END
END

Solution:
  The 4th line from the bottom is incorrect. This should be
CSV_String_Replace(sArguments, ........
instead of
CSV_String_Replace(sActionTmp, ........

This error will result in a minor error in the returned value.
For instance:
calling:
_CSV_MM_GetArgument("Myfunction 1, ,designer , , designer test ")

Whitout any modification to the _CSV_MM_GetArgument cicode function, the
returned value is:
" 1"," ","designer"," "," designer test " With the above modification applied in the cicode file, the returned value will now be:
"1"," ","designer"," "," designer test "

This issue will be assessed for the release of v7.2.
Keywords:

Attachments