I am rebuilding some old Sharepoint Designer forms with InfoPath. The forms support a sharepoint list that we use in the pharmacy for recording the prescription orders received from the hospital wards (in New Zealand). Each morning the staff arrive and there will be a heap of prescriptions received overnight and staff need to enter them in the list with a date and time received of today's date and a specific time. The field is defaulted to Now() and i have a button (javescript) on the old form that the staff simply click and it populates today's date and the time of 07:30.
I've created the form and added some buttons but have become stuck on the formula that i require. I have seen various posts on this forum related to this but none that cover this specific issue. The secondary challenge is that InfoPath creates the date time control formats as two fields - one with the date (date picker) and the second with the time (text). Existing posts that describe a formula for a button to complete the date (eg add 7 days) put the same value in both fields but that then fails the validation step.
I can;t post images but when i open the form the two fields correctly display now() with the date in the first field and the time in the second field. I have a button for reseting the date and time to now() and that works properly - date in one field and time in the other. My second button is labelled 'overnight' and has the following code to the set the field value:
concat(number(substring(now(), 9, 2)), "/", number(substring(now(), 6, 2)), "/", number(substring(now(), 1, 4)), " 7:30:00")
I know my code isn;t right - hence this post, but when i hit the button it pops the same value in both fields (29/07/2022 7:30:00) whereas i just need the specified time of 07:30:00 in the second field. Any ideas?
Thanks in advance