“Invalid Data” error when calculating the result of 2 or more fields

When you create a calculated field in an InfoPath XML node (field) you may find that some of the resulting calculations produce an “Invalid Data” error: This behavior is a known issue when doing floating point calculations and is *not* specific to InfoPath or Microsoft for that matter. The floating point calculation behavior is explained…

1

Calculating Elapsed Time…without code!

UPDATE: Due to the number of requests for adding more columns to this sample, I have re-designed the sample. If I have time in the future I will update the steps to create this new design; however, for now you can download the updated design here to see the changes. The expressions are very similar to…

61

Calculating new, default date and time values

Similar to performing elapsed time calculations, creating a new date or time value based on a previous value used to require code – not anymore! With InfoPath 2007 you can use the new “addDays()” and “addSeconds()” functions to calculate a new date or time based on a previous value. To illustrate this, think of a…

2

Firing rules when removing InfoPath controls

The built-in support InfoPath offers for rules can be used to generate a relatively large and powerful set of conditions that trigger a rule action. There are some scenarios though were the default options available through the condition builder may not be sufficient. One of them is firing a rule when certain control has been…

1

XPath Powers: Calculating Totals

InfoPath makes it trivial to track totals for repeating structures, such as customer orders. Just create a repeating table of line items, and sum up the totals for individual line items. However, sometimes, totals for line items may not be available; it is still possible to perform dynamic calculations across the repeating structure, even when…

6

Conditional Default Values

Sometimes you want the default value of a field to be dependent upon a condition. However, there isn’t any direct functionality to support IF statements in the default values of fields. Substituting a rule for a default value only gets you so far, as the rule is only applied when that field that changes, not the fields…

25

Powerful Declarative Logic: Phone Number Parsing

When entering phone numbers in InfoPath, you can validate that it is a phone number easily enough (Data Validation->field1 “matches pattern” Phone number), but what do you do if the input does not match that pattern? Asking users to exactly enter the format “(000) 000-0000” may be a little constraining. Therefore, you may want a rule so…

10

Complex Data Validation

How do you test more than 5 parameters? How do you group parameters? One answer to both questions, is to have multiple validations in one statement. We’ll look into these problems in detail in the case studies below. Case Study #1 Problem: a form designer wants to use this logic: IF (State=”Ohio” or State=”Alabama” or State=”Arizona”…

4

Do it anyway: Submitting with Data Validation errors

When building a workflow solution using InfoPath, it is often necessary to enforce data validation for some, but not all users. For example, in a simple expense report workflow, Employee->Manager->Accounting, the manager may be required to specify the cost category. The employee, however, can’t provide this data. This means that setting the “cannot be blank” property…

5

Enforcing unique values in a repeating list

Have you ever created a form which allows the user to choose items from a list and you wanted to make sure the user doesn’t choose the same item twice?  If you’ve got InfoPath 2007 you can use the new Multi Select List Box, but if you’ve got InfoPath 2003, you’re still in luck, this blog entry…

3