Use formulas in infopath repeated tables to filter minimum data
By s.y. M. Wong-a-ton
Learn how to use formulas in infopath without usingCode) To find the minimum value of a column in the duplicate table and highlight it.
Requirements:
When you create a duplicate table, which contains a number column, you want to find and highlight the rows with the minimum values. How can this problem be solved?
Solution:
You can use the formula and condition format to find these minimum values.
Steps:
Example:
-
- In infopath 2007, create a new emptyTemplate.
-
- Add a duplicate table and the table contains a hidden column. (For example, field2. You can create a three-column duplicate table and delete the middle column ).
-
- Convert the first column of the tableDate Selector.
- On the data source panel, right-clickMyfields NodeAdd a node namedMindateAnd setThis node is of the date type., As shown in
Figure 1. Repeating table with date and hidden fields and the main data source in infopath design mode.
-
- On the data source panel, double-click the field you hidden in the duplicate table to open its properties dialog box. In this example, this field isField2
-
- InDomain or group attributesIn the dialog box, click the formula button, FX.
-
- In the insert formula dialog box, selectEdit XPath (advanced)Select box ..
-
In the insert formula dialog box, copy and paste the following formula into the formula text box:
Substring (.. /My: field1, 9, 2) + (153 * (substring (.. /My: field1, 6, 2) + 12 * (14-substring (.. /My: field1, 6, 2) Div 12)-3) + 2) Div 5) + 365 * (substring (.. /My: field1, 1, 4) + 4800-(14-substring (.. /My: field1, 6, 2) Div 12) + (substring (.. /My: field1, 1, 4) + 4800-(14-substring (.. /My: field1, 6, 2) Div 12) Div 4)-32083
In the first columnField1(It is a date selector control), that is, you want to find the minimum value.
- ClickOKClose all dialog boxes.
-
- InData SourceIn the panel, double-clickMindateField to open its properties dialog box.
-
- InDomain or group attributesIn the dialog box, click the formula button next to the value text box.
-
- InInsert FormulaIn the dialog box, selectEdit XPath (advanced)Select box.
-
InInsert FormulaDialog box, copy and paste the following formula to the formula text box:
.. /My: group1/My: group2/My: field1 [.. /My: field2 = xdmath: min (/My: myfields/My: group1/My: group2/My: field2)]
-
- ClickOKClose all opened windows
-
- Double-clickDate SelectorControl, openAttributeWindow
-
- InDate selector attributes, SelectDisplayTab, and then clickCondition format.
-
- InCondition formatIn the dialog box, click Add.
-
InCondition formatDialog box, add two conditions:
Field1 equals mindate
And
Mindate is not empty
- InCondition formatDialog box, select a color for the shading, and then clickOK.
-
- ClickOKClose all open dialog boxes.
Figure 2. Selecting the minimum date in a column of a repeating table in infopath.
Success! When you add a new row in the duplicate table, the minimum value is displayed.
This solution also applies to browser-compatible formsInfopath 2007 browser forms.