Microsoft InfoPath 2010
The official blog of the Microsoft InfoPath team

How can you store the result of an InfoPath expression box?

How can you store the result of an InfoPath expression box?

  • Comments 0

Question: How do I store the result of an InfoPath expression box?

Answer: with InfoPath 2003 SP1 you can use the new calculations feature.  With InfoPath 2003, you can write script.

The expression box control is display only, so whatever expression you end up concocting to render on the screen is neither stored in the XML nor accessible for manipulating elsewhere.  You might want this expression value to be stored in the XML, especially if you want to promote this value into a SharePoint form column.

In InfoPath SP1, rather than using an expression box, you can set the default value for a field element to be a calculated value.  If the field is in the view, bring up the property dialog for the control associated with the field.  If the field isn't in the view, you can go to the data source and bring up the properties for the field there.  Note the fx button next to the default value.  Click that to bring up a dialog for creating a calculation.  This expression will be recalculated as needed and stored in the field.

To do the same thing in script, download the InfoPath SDK and look into the calculations sample.  Go to this page for more information: (along with a discussion of the script).

Leave a Comment
  • Please add 1 and 4 and type the answer here:
  • Post