I am following this tutorial to include a condition in a default value of a textbox: http://blogs.msdn.com/b/infopath/archive/2006/11/27/conditional-default-values.aspx
In a nutshell [if a date is greater than 12/31/14, default value shall be (textbox1A / textbox2A), else (textbox1 / textbox2)], translated to actual field names in my form then my default value for AverageScore3 is entered as such:
(SumRatings3 / NumChecked3 | SumRatings3A / NumChecked3A) [(DueDate > dateCompare) + 1]
translates to xpath:
(./my:Safety_3/my:group3/my:SumRatings3A / ./my:Safety_3/my:group3/my:NumChecked3A | ./my:Safety_3/my:group3/my:SumRatings3 / ./my:Safety_3/my:group3/my:NumChecked3)[( ./my:EmployeeHeaderSection/my:DueDate > ./my:Debug/my:dateCompare) + 1]
Yet I am receiving this error message with my expression in the default value field:
The expression is not a node-set.
-->(./my:Safety_3/my:group3/my:SumRatings3A div ./my:Safety_3/my:group3/my:NumChecked3A | ./my:Safety_3/my:group3/my:SumRatings3 div ./my:Safety_3/my:group3/my:NumChecked3)<--[( ./my:EmployeeHeaderSection/my:DueDate > ./my:Debug/my:dateCompare) + 1]
I cannot use code behind to accomplish this because the form uses qRules and DBXL. I also cannot use Rules because I am modifying a form that needs the formula to remain intact for existing forms. The approach I am taking then is to have a default value with a condition so the old formula works for existing forms, and the new formula works with new forms. Maybe there's a better way?
The Copy XPath for the fields in the formula is:
DueDate = /my:myFields/my:EmployeeHeaderSection/my:DueDate
dateCompare = /my:myFields/my:Debug/my:dateCompare
AverageScore3 = /my:myFields/my:Safety_3/my:AverageScore3
NumChecked3 = /my:myFields/my:Safety_3/my:group3/my:NumChecked3
SumRatings3 = /my:myFields/my:Safety_3/my:group3/my:SumRatings3
NumChecked3A = /my:myFields/my:Safety_3/my:group3/my:NumChecked3A
SumRatings3A = /my:myFields/my:Safety_3/my:group3/my:SumRatings3A
Question: the first part of my expression is not a node set, but which node?