I’m attempting to create a view agent that does the following (on all documents selected):
-
pull the values in multi-value field “Activity”. The field has multiple text items of the type “date - activity text” (with space,dash, space separating the pieces of text)
-
parse the “date” portion of the text and place in value of “tmpDate” (leftmost up to space, dash, space)
-
parse the “activity” portion of the text and place in value of “tmpAct” (rightmost after space,dash,space)
-
create a new document of type “Mod_Activity”, which is a reponse document, inherits values from the parent (really, only the $ref is ever used…)
-
On “Mod_Activity” form, sets value of “Activity_Date” field to “tmpDate”
-
Sets value of “Activity_Enter” to “tmpAct”
-
On the parent document, sets the value of “Recent_Activity” to today’s date
-
Saves and closes the response document
-
Goes to the next line item in the original document and starts the process again.
Here’s the agent code so far:
@If(@Elements(Activity) = 0; @Return(0); “”);
n := 1;
@DoWhile(
tmpDate:= @left(Activity; " - ");
tmpAct:= @Right(Activity; " - ");
@command([Compose]; ""; "Mod_Activity");
@SetField("Activity_date"; tmpDate);
@SetField("Activity_enter"; tmpAct);
@SetDocField($Ref; "recent_activity"; @Today);
@Command([FileSave]);
@Command([FileCloseWindow]);
n := n + 1;
n <= @Elements(Activity);
)
I’m getting an error that I’m missing an expected function, though I have no idea why. (Shows up at the last parenthesis in the formula). I also haven’t been able to test the agent since it won’t save the formula in its current state.
If anyone can tell me if the logic/programming will fail, let me know why or a possible fix. This would be greatly appreaciated.
Thanks in advance.