One of several updates that Geocortex Workflow received back in June introduced a new Cast activity functionality. The Cast activity allows you to tell the Workflow Designer which type a particular value is, which allows you to use that value in subsequent activities where previously you would have encountered validation errors.
This also aids with suggestions in expressions as you can dot into the properties of the type you specified.
Watch us demonstrate how easy this is to set up, and how powerful it can be in this week’s Geocortex Tech Tip!
“Hi. I’m Ken Lyon, I’m a member of the Workflow team here at Geocortex and today I’m going to show you how to improve suggestions by using the Cast activity. Let’s get started!
Workflow Designer has got a lot of useful type information for a lot of the activities, but in some cases that is limited because we don’t know exactly what type you’re going to be getting back, so consider the web request.
If you’re doing a ‘Send Web Request’ operation here, you’re going to put in a URL, and we give you a few different options for output here.
You might have string, JSON or a blob if it’s binary data, but let’s say you’re doing a call to something and you know exactly what type of JSON you’re going to be getting back. You need something more in order to be able to tell Workflow what the type is and so for that, we have the new Cast activity.
I previously had Cast Geometry, which allows you to cast a generic geometry to more specialized geometry, but the new Cast activity is much more broad.
So, I drop this on here and it gives me a list of suggestions of types. Just to give you an idea you can type
anything in here, but the variety of types that we suggest for you. For now, I’m going to select ‘esriPolygon’ and I’m going to see which input that is.
So, that’s going to be the JSON from the web requests, imagine we’ve just got a polygon from some web request and then we have the output there.
Now let’s see if we’re going to be calculating the area of that polygon.
If I had been just doing it directly on the web request then that would just say a generic JSON object, but if I use the Cast activity, you can see the result shows ‘esri.Polygon’ and so then I could even dot into that and see the different properties of the polygon and use that there. So, it’s just one example of how you can get a more detailed response.
Now another thing you can do is let’s say I just start over and I have a Create Value. I’m going to create a value and it’s just going to be an object and I can say ‘a:1, b:2’, right nothing really especially fancy there.
But similarly again, if I wanted to look at that value I mean this is just going to show as an ‘any’ in here but I can cast that to my exact type that I just said.
You can see here’s an example we’ve got here, but let’s say I do my type here. So that was a is ‘a’ number, and then ‘b’ is a number. So that’s like the type definition, and I’m going to say ‘$value1.result’ and then if I was going to go here to log, I could say ‘$cast1.result’ and you can see that showing ‘a’ is a number, ‘b’ is a number.
So, I’ve got my ‘a’ and ‘b’ properties defined on here; compare that to if I was just doing value result, I would have no suggestions there.
That’s just a quick example of how the Cast activity is pretty powerful, and lets you specify the exact type of what you’re using.
Thanks for your time and I hope this has been useful! See you next time!”
Want to take a closer look at Geocortex Workflow in action? Click the button below to learn more about the product, or to schedule a demo.