I got an email earlier this week from Richard Tubb asking a couple of questions about InfoPath.
This is also the same Mr Tubb who has been “nagging” me to post more about InfoPath and SharePoint. I do take his point as I’ve posted very little on the topic since I spoke about it at AMITPRO last year (can’t believe it’s been nearly 12 months since that!)
I’ll talk about InfoPath in the Office 2007 world at the moment. Even though the latest version is upon us the current version will be hanging around for a while. Also the skills are transferrable and I’ll need material for future posts right? 🙂
What is InfoPath?
In a nutshell it’s all about electronic forms.
If you’ve ever created a form in Microsoft Access it’s along similar lines. What’s cool about InfoPath though is that it isn’t tied into a specific database system. It can talk to SQL Server, Access databases, SharePoint (which is is it’s main strength) and more. You can even make use of InfoPath forms within Outlook to gather information via e-mail!
I also think that when stacked up against a form in a Word document InfoPath wins a lot!
InfoPath allows you to do form validation to ensure data is entered correctly.
It’s biggest strength is it’s capability to “unlock” data which a Word document just can’t do. (Unless you want to do a lot of VBA coding)
This means an simple example is in order.
Lets say you had a Word document that your staff used to enter their weekly hours worked.
It might look like this.
As you can see there is a lot of important information here.
At the top we have data that lets us know who the time sheet belongs to, and when it’s for.
Moving down we have the actual data itself.
The hours worked.
Finally we have a brief summary of data so you can see at a glance what’s going on.
So what’s wrong with this?
You would have to trust whoever fills out the form to put a date in right place and numbers in the hours worked fields. What if someone enters 25 hours for single day? What if “Sales” isn’t even the correct name of the department?
Now you can sort of do this in Word 2007. But it’s not exactly simple. In fact, good luck finding how to insert a form field – The developer tab is hidden by default (I’ll explain how to display them in another post). Then you have to contend with “legacy form controls” and the new Office 2007 form controls. Not fun at all!
Once again you’d need to trust whoever is filling out the form to get their maths right. As with data validation you can get Word to do calculations on tables but it’s not exactly simple or intuitive!
This is the biggie!
I’ve only showed you one form. Let’s imagine you’re Mr Anderson’s line manager. Your boss walks up to your desk at 9am Monday morning and tells you that your department is spending a fortune in overtime. He wants to know exactly how many hours your department logged in overtime for the last three months overall and on a per-person basis…..and he wants it for the management meeting at 11am!
So lets say that each person would have 4 timesheets per month. That’s 12 per person.
If your department had 5 people in it that’s 60 Word documents you need to open, read through, check the maths and note the important figures to bring into your total summary.
That’s going to take some time!
How does InfoPath help?
Here’s the same form designed in InfoPath
At first glance you’ll notice it’s essentially the same form as before
But if you look in the first block of data
You can see a calendar control button. This means I can choose a date with the mouse as well as typing one in.
It won’t let me put anything other than a date in the field.
You’ll also notice all the fields in the first section have a red star next to them.
This because I’ve made them mandatory fields. It’s a little visual notification to remind the user to put some data in.
You also get InfoPath to pop up a little message if no data is entered!
The fields that contain the hours worked data also have some validation rules.
This screenshot shows I’ve tried to enter some text in a numeric field
We get the nice red dotted border AND a tooltip to let me know what’s wrong.
What’s really cool about this is that I didn’t even need to set this up. Just by specifying that the field was numeric InfoPath setup the basic validation for me.
Each control has LOTS of options around data validation to make sure we get exactly the correct data in.
You may also have noticed that the department field is a drop down list.
This means that we can ensure that only valid departments are entered. You’ll see why this can be quite important later on.
Also, the data is actually pulled in from a SharePoint list.
This means that these lookup lists can easily be managed without having to edit the InfoPath form. We can also set security on the SharePoint list to ensure only specific people can make changes to the department details.
InfoPath also has rules and events we can work with. We could actually set this up so all the staff names appeared in another drop down and that once a department has been chosen only the staff in that department are shown (or vice versa. You choose your name and your department is automatically filled out)
This totally solves the Data Validation problem I mentioned above.
So what about calculation?
Same form as above with the same data entered
However this time the summary data is updated automatically.
I’ve set the summary fields to do a simple bit of addition and then made them read-only so they just work on there own without any user input needed!
Data Validation and Calculation all dealt with quickly and easily.
I could understand if you were still a little sceptical at this point though. As i said lots of similar functionality is already available all across the Office suite. That brings me onto the final point I made above.
The real magic happens when this is published to a SharePoint site.
When I published the form I specified that I wanted the summary fields to be pushed through to the SharePoint form library.
This is called “property promotion”.
Here is the time sheet Tom Anderson just filled out on the SharePoint site.
I can now see how many hours Mr Anderson worked that week without even opening the file!
Multiply this across the whole team and you can see at a glance what everyone was up to!
Let’s throw a bit of SharePoint magic in.
I’ve grouped by Department and then by Week Commencing Date.
Can you see why it was important to get the department entry consistent?
We can now get a real overview of the hours entered by each person.
And one finishing touch.
I’ve asked SharePoint to sum the totals fields.
This can look a little confusing your grouping as it gives you overall totals as well as a total at each group level. You’d be better setting up a filtered view to do this.
Something like this.
I’ve removed a level of grouping and filtered to only show the Sales team.
You can now see really easily over the last two weeks the Sales team have posted 18 hours of overtime.
Just to show off….you could then dump this out to Excel for further analysis.
I created that chart with about five clicks of the mouse. Getting that report together for the boss would be nice and simple.
Finally one other cool thing about using SharePoint and InfoPath for a solution like this.
The files themselves are stored in XML format
This means if yoy needed integration with another system (your accounts package for example) this makes the whole thing a lot easier.
I’ll stop there….this was supposed to be a quick introduction.
If you’ve made it to the bottom of this post thanks for the reading!
This was just one example of how you can use InfoPath in a real world scenario.
There is lots more you can do, especially when you put it together with SharePoint.
For example, imagine having an expenses form tied into a workflow so that management approval is required when a certain monetary threshold is met?
Hopefully this all makes sense and you can see why I’m such a fan of InfoPath!
Please comment if you want me to post more about InfoPath and I’ll be happy to do so 🙂
*I’ve just noticed all the dates are in US format….I didn’t change the regional settings on my newly created test site…..i’m not re-doing the screen shots though! *