Hi all,
Have been browsing for this already and suspect it is either a) impossible or b) quite complicated to achieve, but figured it's no harm to ask anyway...
I'm designing a form template which will have multiple sections based on daily, weekly or monthly data.
Above each section I have a date picker to allow the user to specify exactly what period they are reporting on (so three independent date pickers)
I want to format the displayed date based on the period - for Daily and Monthly, this isn't a problem, as I can just set the format of the control to be either dd-mmm-yyyy (Daily) or mmm-yyyy (Monthly) and it will show perfectly. The problem arises for Weekly, as there is no pre-defined format for 'Week Ending' (which could then show the date of, say, the preceding Friday?) or 'Week Of' (which could show a date range from Monday to Friday, á la "15-19 October 2012")
My intention was to add a text-box next to the date-picker and add a rule / formula to populate the text box based on the date-picker value. So the user could pick a random date in the date-picker and the text-box would populate one of the two formats described above (i.e. the date of the preceding Friday, or the dates of both the preceding Monday and Friday - whichever I can achieve!)
The problem is obvious; I don't know how to put such a formula together based on the pre-defined formulas that are available in the GUI (absence of 'IF' or 'WEEKDAY' functions, to use Excel/VBA as an equivalent) and suspect such a formula may not even be possible.
So I'm guessing this can only be done through code, but while I could knock this up in VBA in 2 minutes, I'm new to coding in InfoPath (does it use C / C++?...) And also concerned about adding code-based functionality as the end-users may not have InfoPath installed and not sure if that would be a requirement in order to have this kind of code running in the background?...
Thanks in advance for any pointers you can give?
APMOB