Saturday, May 27, 2006

InfoPath 2003: Tips

1. Create a “please wait” and a “start up” screen when you receive or submit data to a data source.
(Use a combination of the OnContextChange and OnSwitchView InfoPath methods to create such please wait views.)

2. Use the Wingdings font to show images on buttons

3. Provide a static class in JavaScript or C# which contains methods to obtain data fields of your form. It will save you a lot of code to get and set data in your form!

Example:
my:myFields
---- my:Customer
--------- my:CustomerName
---- my:Product
--------- my:ProductName

> Use: Path.GetInstance(thisXDocument).GetCustomerItem(“my:CustomerName”)
> Class: Path
> Static Method: GetInstance(XDocument thisXDocument) [singleton pattern]
> Methods GetCustomerItem() (to retrieve object(s) of IXMLDOMNode = return type)

4. Avoid cycles, think about the need of rules,

Please think about ...

  • how many rules I will need,
  • which fields must have rules.
  • ...

    (Without this analysis, you will create cycles in complex forms)
    (Too much rules are not maintainable)

5. Let's hope that InfoPath 2007 will provide more functionality:

  • Clickable images
  • Support for repeating sections within other repeating sections (no recursion)
  • a list with all rules and conditional formatting per control and field

InfoPath 2003: do's and don'ts

I am currently a Office - InfoPath 2003 consultant. I really learn a lot about InfoPath and its boundaries. In my opinion it's interesting to summarize some practical do's and the don't for InfoPath 2003 before you promote InfoPath as Office's wonder. Those do's and don't can be a start for a new post. ;-)

Here they are:

Don’ts

- Do not make applications in InfoPath 2003 with logging, historical data
- InfoPath 2003 does not support workflows
- Do not create a form with one or more views for several roles when each role or view has its
own rules. Rules are bound to data fields. So, if you use a rule on view 1, the rule will also be executed in other views. On the other hand conditional display formatting will be executed per control which represents a field on one view. So, a conditional formatting on view 1 will not influence other views.

- Do not use InfoPath as GUI + business + database
- InfoPath does not support multi – languages (if the company forbid to use several views per language)


Do’s

- Create forms in InfoPath 2003 without workflows. Do not call your form an application !!!

Examples:
a form to request your holiday, a form which represents a bill and calculate totals


- InfoPath is perfect to replace the GUI part of your application, but it’s very difficult to replace all layers in your application.

Use InfoPath to show and format data from databases, web services, SharePoint, …
InfoPath can be a perfect smart client which can show, send, format, calculate data … but nothing more …

- If you use different rules on the same fields for different form users (roles). I suggest to divide the form in more than one form which will separate the rules for all different users. So, there will be no rule-conflicts.

- I prefer Visual C# to write custom code. You can use the IntelliSense of Visual Studio which can reduce frustrating moments in JavaScript.