Nintex Forms 2016 for SharePoint
I have a form where the user selects a Location from a dropdown list, and then they are presented with the results of several lookup() functions that describe the Location. In particular, the form displays PreviousServiceDate and NextServiceDate for the selected Location.
Upon opening the form he lookup() boxes are blank until a Location is selected. When making the 1st Location selection, both PreviousServiceDate and NextServiceDate are incorrect. Upon selecting a 2nd Location the date calculations work correctly, and for all subsequent selections while on the form. It is like the runtime functions do not activate until the 2nd selection is made.
Here's how my functions work:
Location is selected: Choice dropdown
ServiceSchedule is found: lookup("LocationInfoList","LocalName",Location,"ServiceSchedule")
MondayDefined: Calculated Value: date(22,04,2019,00,01)
DiffDays: Single Line Text Box: dateDiffDays(MondayDefined,Today)
Calculated Value: RoundDown7: round(((DiffDays/7)-0.5),0)*7
Calculated Value: PreviousServiceDate: dateAddDays(MondayDefined,RoundDown7)
If PreviousServiceDate = Today, dateAddDays(PreviousServiceDate ,-7)
...similar for NextServiceDate
The 1st selection of Location initializes the date calculations from MondayDefined and skips the dateAddDays() function. The 2nd selection prompts the dateAddDays() function.
Can anyone help me solve this bug so that the 1st selection initializes all runtime functions correctly?
the behavior you describe sounds to me not to correspond with formulas you provided...
once you select/change Location dropdown, ServiceSchedule recalculation is triggered and some result is possibly returned.
but I don't see any other formula that would depend on Location or ServiceSchedule, so nothing else gets recalculated.
MondayDefined seems to be calculated out of a static value which never changes, so it's calculted just once on form load.
for DiffDays you stated its 'Single Line Text Box'. but I don't think so. you couldn't reference the MondayDefined (runtime) named control from an inline function which is only possible within text box control. if MondayDefined within this formula is an 'Item property' (aka list field), the same applies - item property references are evaluated just on form load.
so I'll assume it's calculated value control as well...
so, based on the MondayDefined calculation output, some date difference to current date is calculated. since neither MondayDefined nor Today/current date change throughtout the form session, DiffDays is as well calculated just once on form load.
and just the same for all the rest of the calculations, since they only depend on DiffDays.
so, from my point view, you do get some senseful result just on form load. all the later Location changes doesn't have any effect on the calculation.
please provide screenshots of your configuration rahter then trying to describe it...