Forms don’t just capture user inputs; often certain elements must hide or appear based upon user interactions. Geocortex Workflow 5 forms let you re-imagine the user experience by using cascading drop downs and an advanced event-based system to engage users with extraordinary versatility.
In a Geocortex Tech Tip from a few weeks ago, Ryan showed you how to get started with forms in Geocortex Workflow 5. In this week’s follow-up Tech Tip, Ryan shows you how to manage the data you collect with forms, and pull it into your workflows so you can execute your business logic.
“Hi, my name is Ryan Cooney, I’m the Product Owner for Geocortex Workflow 5. Today we’re going to have a look at how you can extract user data from Geocortex [Workflow] forms. Let’s take a look.
In Geocortex Workflow 5, the “displayform” activity is the primary mechanism for creating a user interface and presenting something to end-users. Typically, what we’re trying to do is ask the users questions, or prompt them to supply some values so we can take that information and go on to perform some business process that’s going to meet their needs.
If we look at this “displayform” activity here, it’s composed of form elements and we can just drag-and-drop various elements out of the toolbox onto the design surface. So here I have a text box, called “textbox1” – just a simple form.
Let’s take a quick look at actually running this really simple one. If I run it, all we’re going to get is a text box. The user can type anything they like into it, click submit, and the workflow ends. So, we haven’t done anything useful with the data in this form yet.
To get at that data we need to follow the “displayform” activity with another activity that reaches into that form and pulls a value out. I’m going to use the “alert” activity. The “alert” activity is expecting some text input, and we can provide an expression that controls where that text input is coming from. If I just hit “=” I’m going to get code completion that suggests some values for me. Right here, it’s suggesting “$Form1” as a value, which is referring to the “displayform” activity that we’ve already used.
OkK so if I just save that and go back to my sandbox to run the workflow again, I get the same input, click submit, and now I’m getting an alert that’s presenting that value [I entered].
That’s a simple case of drilling into a very simple form element and reading off the text value, but if we look at some of the other form elements that we have available to us, they can be more interesting. [For example], dropdown lists with different types of values they could return. We have geometry pickers that allow the users to capture one or more geometries. So, the value we’re pulling out of those inputs can get much more complicated than just a text string.
There’s other simple ones like a checkbox, that if you want to make a decision based on whether a user has ticked a box, it would be a “checkbox.checked” property, for example.
So, we have lots of different options available to us, but the flow is basically going to be the same: layout your form element, and then use an expression to drill into the specific input you’re after, and then access a property of that input. And that’s how we get data out of the form and into the workflow where we can run all our business logic where we’re making decisions about how we process what the user provided.
Hopefully that gives you a quick overview of how you can get data out of a form.”
Want to see how Geocortex Workflow can help you extend your Web AppBuilder applications and streamline inefficient processes? Check out the Discovery Center to get a feel for the product.