How do I loop through a keyword field or variable in Workflow Manager?

At first, please be aware of a known limitation when using loops; after one task (e.g. condition "loop condition") has ben executed 50 times without human interaction the loop detection will be triggered and the workflow will be unpublished! Here's how to avoid that (On-Premise only).

Now that you know, you can set up the "keyword loop" using the following steps: 

  1. Create empty tasks, name and connect them as in the screenshot
  2. Create the following three variables: keywordCount (Numeric), i (Numeric), lineContent (Text)
  3. Set the loop counter to '0' and get the count of lines in the keyword field
    set counter
  4. In the condition, you check if the loop has to run again or is at its end
    loop condition
  5. Inside the loop, you get the text of the line you are processing at the moment and increase the loop counter
Comments (2)
  • Careful with keyord fields that may be emtpy! (Version 7.3)

    Beware that using the Count() method works for getting the length of empty keyword fields that are index fields (the example shown uses DW_KEYWORD, which is obviously an index field), but fails when used on empty keyword fields that are global variables with an ArgumentNullException in the workflow designer and with "Fehler in der Systemaktivität: Der Wert darf nicht null sein. Parametername: source" in the Workflow history.
  • I know this is a late reply, but if checking the .Count() method or .Length property on a keyword global workflow variable you can check if it is null first with GV_KeyWord = null.  Then if it's not null you can check the length.