Modify a variable in a workflow
This seems like an easy thing to do but for the life of me I can't figure out how to do it in a workflow. I need to modify a user's input if it isn't in the correct format by adding leading zeros. For example: if they enter 12, I need to change the value to 0012. Likewise if they enter 4, I need to change it to 0004. I see how to add an IF statement or switch statement but I can't figure out how to change the variable.
Another situation, I need to add two numbers that have been collected as part of the workflow but I can't figure out where to put the code.
Any suggestions would be most appreciated - I am pulling my hair out. Workflow seems to allow you to do ALL kinds of cool stuff but the simple things are throwing me for a loop.
Thanks,
Bryan
0
-
Hi Byran,
For the first problem you can use the string.PadLeft(int totalWidth, char paddingChar) method (http://msdn.microsoft.com/en-us/library/92h5dc07) http://msdn.microsoft.com/en-us/library/92h5dc07 .
If you have a string variable called "text" you should be able to do this to return a new string 4 characters long with the zeros padded on the left:
text.PadLeft(4, "0"c)
--Ryan
0 -
Hey Ryan, Thanks for tip but what I can't find is an activity to drop into the IF statement. I set the condition but I can't find any activity that will let me manipulate the variable. BTW - caught your 1st Workflow session today at the user conference - nice job. Hope to watch the advanced session in the morning. 0 -
Hi Bryan
how about Assign'?
Thanks
Ralph
0 -
Oh . . . Well that was easy!! Thanks for the help - guess I saw "Common Server" and associated those tools with ArcGIS Server. 0 -
I think that just means an Activity commonly run on the server as compared to client
Good luck
Ralph
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
5 kommentarer