What do we need
- 2 date fields in the datasource, startDate, endDate
- 1 text field dayDifference
Step by Step
- Go to the datasource of your InfoPath Form
- Go to the properties of startDate field, and add a rule
Condition: endDate is not blank
Actions: Set field dayDifference = 0;4096
- Go to the properties of endDate field, and add a rule
Condition: startDate is not blank
Actions: Set field dayDifference = 0;4096
- Go to the properties of dayDifference field, and add 2 rules
RULE 1
Condition: The Expression : xdDate:AddDays(../my:startDate, substring-before(., “;”)) != ../my:endDate AND
DayDifference contains ;
Actions: Set field dayDifference = concat(substring-before(., “;”) + substring-after(., “;”) * ((translate(addDays
(startDate, substring-before(., “;”)), “-”, “”) < translate(endDate, “-”, “”)) * 2 – 1), “;”, substring-after(., “;”) / 2)
(Don’t forget the select the Edit Xpath checkbox)
RULE 2
Condition: DayDifference contains ;
Actions: Set field dayDifference = substring-before(., “;”)
Your form is ready, it works also in repeating controls.
hi what is the mean of 0 4096 ?
ReplyDelete