
Announcements
Hi, I have a calendar created:
The Onselect for the Continue button is:
Set(varBonusStartDate, DateValue(Text(_selectionStart, ShortDate)));
Set(varBonusEndDate, DateValue(Text(_selectionEnd, ShortDate)));
Collect(yourCollection,
ForAll(Sequence(DateDiff(varBonusStartDate, varBonusEndDate, Days)+1, 0),
{colDate: DateAdd(varBonusStartDate,Value, Days)}
)
);
Set(varBonusDateCount, CountRows(yourCollection));
UpdateContext({viewCalendar:false});
If I select Days 11 & 12, yourCollection will have those days added to the collection. But, if I re-open the calendar and want to change the days selected to Days 10 & 11, in my collection I have 10, 11, 11, 12 days (4 days). Instead of 10 and 11. How do I get 10 & 11 without clearing the collection all together?
I do have a button that will clear all:
UpdateContext({viewCalendar:false});
Clear(yourCollection);
Set(varBonusStartDate, Blank());
Set(varBonusEndDate, Blank());
Set(varBonusDateCount, Blank());
The code on the SELECT of the Day is:
If( Month(DateAdd(_firstDayInView,ThisItem.Value,Days))<>Month(_firstDayOfMonth),
0,
_selectedCount > 0
&& DateAdd(_firstDayInView,ThisItem.Value,Days) >= _selectionStart
&& DateAdd(_firstDayInView,ThisItem.Value,Days) <= _selectionEnd,
UpdateContext({_selectedCount: 0}),
_selectedCount = 1,
UpdateContext({_selectionStart: Min(_selectionStart, DateAdd(_firstDayInView,ThisItem.Value,Days)),
_selectionEnd: Max(_selectionStart, DateAdd(_firstDayInView,ThisItem.Value,Days)),
_selectedCount: 2}),
UpdateContext({_selectionStart: DateAdd(_firstDayInView,ThisItem.Value,Days),
_selectionEnd: DateAdd(_firstDayInView,ThisItem.Value,Days),
_selectedCount: 1}))
It seems to me that the issue is when I deselect the calendar day (no longer high-lighted) the _selectionStart and the _selectionEnd entry is still the last entry selected, they do not go back to blank. Any thoughts on how to do that? I guess it has to do with my count???