How to get a substring in a Workflow Activity?

I'm concatenating some values into a Summary field in a workflow activity as follows:

IIF(Eq([//Target/Code1],True),"1,","")+IIF(Eq([//Target/Code2],True),"2,","")+IIF(Eq([//Target/Code3],True),"3,","")

So if Code1 and Code2 are true I get a Summary Value of 1,2,

Now I want to trim the trailing comma.

So I did this

Left([//Target/Summary],Add(Length([//Target/Summary]),-1))

This part doesn't work.  It says Left is improperly formatted or missing a parameter.

If I put a numeric value like 1 or 2 as the second value it works.

 Any suggestions on how to get trim a character off the end of a string in a FIM Workflow activity?

April 30th, 2015 4:22pm

Length isn't a function supported by the FIM Function evaluator Workflow activity. (Which is frustrating).

Here is my sloppy approach using the built-in tool (lots of nesting so if you need to do this for more than 3 conditions this grows out of control):

IIF(Eq([//Target/Code1],True),IIF(Eq([//Target/Code2],True),IIF(Eq([//Target/Code3],True),"1,2,3","1,2") ,IIF(Eq([//Target/Code3],True),"1,3","1") ) ,IIF(Eq([//Target/Code2],True),IIF(Eq([//Target/Code3],True),"2,3","2") ,IIF(Eq([//Target/Code3],True),"3","") ))

OR you can use one of these custom workflows that allows you to run your own code:

http://fimwf.codeplex.com/

or

https://fimactivitylibrary.codeplex.com/wikipage?title=Code%20Run%20samples&referringTitle=Documentation

Free Windows Admin Tool Kit Click here and download it now
May 1st, 2015 12:22am

Thanks for the response and the suggestion.

I actually have 5 codes so I took your suggestion and added some steps to my workflow like this:

This is most of it.  The problem I have is that the values that should be going into the WorkflowData targets don't seem to be populated when I try to use them in step 3.  Am I missing something basic?

Value Expression Target
1 IIF(Eq([//Target/Code1],True),IIF(Eq([//Target/Code2],True),"1,2","1"),IIF(Eq([//Target/FERC2],True),"2",".")) [//WorkflowData/Summ12]
2 IIF(Eq([//Target/Code3],True),IIF(Eq([//Target/Code4],True),"3,4","3"),IIF(Eq([//Target/Code4],True),"4",".")) [//WorkflowData/Summ34]
3 IIF(Eq([//WorkflowData/Summ12],"."),IIF(Eq([//WorkflowData/Summ34],"."),".",[//WorkflowData/Summ34]),IIF(Eq([//WorkflowData/Summ34],"."),[//WorkflowData/Summ12],[//WorkflowData/Summ12]+","+[//WorkflowData/Summ34])) [//WorkflowData/Summary]




  • Edited by MS...CF 16 hours 37 minutes ago
May 5th, 2015 10:50am

Thanks for the response and the suggestion.

I actually have 5 codes so I took your suggestion and added some steps to my workflow like this:

This is most of it.  The problem I have is that the values that should be going into the WorkflowData targets don't seem to be populated when I try to use them in step 3.  Am I missing something basic?

Value Expression Target
1 IIF(Eq([//Target/Code1],True),IIF(Eq([//Target/Code2],True),"1,2","1"),IIF(Eq([//Target/FERC2],True),"2",".")) [//WorkflowData/Summ12]
2 IIF(Eq([//Target/Code3],True),IIF(Eq([//Target/Code4],True),"3,4","3"),IIF(Eq([//Target/Code4],True),"4",".")) [//WorkflowData/Summ34]
3 IIF(Eq([//WorkflowData/Summ12],"."),IIF(Eq([//WorkflowData/Summ34],"."),".",[//WorkflowData/Summ34]),IIF(Eq([//WorkflowData/Summ34],"."),[//WorkflowData/Summ12],[//WorkflowData/Summ12]+","+[//WorkflowData/Summ34])) [//WorkflowData/Summary]




  • Edited by MS...CF Tuesday, May 05, 2015 2:52 PM
Free Windows Admin Tool Kit Click here and download it now
May 5th, 2015 2:49pm

I suggest creating a logging activity and putting it in place in between each step to ensure that they are really populating. That or switch to the C# workflow activity and then you can just do it in much simpler code
May 5th, 2015 8:48pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics