Hi ,
Can you help me in this . I do have a form like below which will take multiple values from each drop down with selected date range and mark the data in separate rows .
Issue : If I select a data range example as below from June 1 to 6 ,data's are getting added from 2 to 6 June .From date is getting missed - June 1.
Thanks !
Set(
fromDate,
DatePicker1.SelectedDate
);
Set(
toDate,
DatePicker2_1.SelectedDate
);
Clear(MyCollection1);
ForAll(
Sequence(DateDiff(fromDate, toDate)) As seq,
Collect(MyCollection1,
AddColumns( 'ComboBox1_4 name'.SelectedItems As C , Date , DateAdd(fromDate, seq.Value, TimeUnit.Days), Name,'ComboBox1_4 name'.SelectedItems)
)
);
// Check if a record with the same Name and Date already exists
Set(
existingRecords,
Filter(
Table1,
Name = 'ComboBox1_4 name'.Selected.Value &&
Date = DatePicker1.SelectedDate
)
);
If(
CountRows(existingRecords) > 0,
// Get the name of the existing record
Set(
existingRecordName,
First(existingRecords).Name
);
Notify("A record with the same Name and Date already exists for " & existingRecordName, NotificationType.Error),
// If no existing record found, add a new record
ForAll(
MyCollection1 As C,
Patch(
Table1,
Defaults(Table1),
{
Manager: 'Dropdown1_4 -mng'.Selected.Value,
Team: 'Dropdown2_4- team'.Selected.Value,
Name: C.Value,
Date: C.Date,
Hours: TextInput1.Text,
Leave: 'Dropdown4-leave'.Selected.Value
}
)
);
Navigate(DataTable1)
)
