Apologies as this was my first post. Please see details below.
A user enters the times and selects the item. the rate is auto-populated and the calculations are done to get the total. this form data is then collected in the QuoteDatacollection for use in the quote page in a gallery.
Specific items from the collection are populated into a gallery.
This is the list with the Support items.
This is the list the Quote Data goes into from the form with the Choices column from the Price List (Sample data included).
I have tried different variants of the following but the items are not showing in the Quote page, it just shows the standard item with no rate or total.
Set(
ExistingItem,
LookUp(
QuoteDataCollection,
'NDIS Support Item' = NDISSupportItem.Selected.Value && Ratio = RatioSelector.Selected.Value
)
);
If(
!IsBlank(ExistingItem),
Patch(
QuoteDataCollection,
ExistingItem,
{
Hours: ExistingItem.Hours + (Value(Hours.Value) * QuoteWeeks.Value),
Total: ExistingItem.Total + Value(Gallery2_3.Selected.Total)
}
),
Collect(
QuoteDataCollection,
{
'NDIS Number': SupportItemNumber.Value,
Service: SelectedService.Value,
Day: FormattedDaysTable,
Occurrence: Occurrence.Selected,
Year: QuoteYear.Selected,
Frequency: QuoteFrequency.Selected,
'Custom Frequency': CustomFrequency.Value,
'Service Start': Text(DateValue(ServiceStart.SelectedDate)),
'Service End': Text(DateValue(ServiceEnd.SelectedDate)),
Weeks: QuoteWeeks.Value,
'Start Time': StartTimeSelector_lbl2_2.Text,
'Finish Time': FinishTimeSelector_lbl2_2.Text,
Hours: Value(Hours.Value) * QuoteWeeks.Value,
'NDIS Support Item': NDISSupportItem.Selected.Value,
Ratio: RatioSelector.Selected.Value,
Rate: Text(Value(SupportRate.Value), "[$-en-US]#0.00"),
'Custom Rate': CustomRate.Value,
'Num Staff': NumOfStaff.Value,
Desc: QuoteDesc.Value,
Assigned: AssignedStaff.Value,
Total: Text(Value(QuoteTotal.Value), "[$-en-US]#0.00"),
CompDate: DateValue1.SelectedDate,
UserMail: UserMail.Value,
Hour: HourValue1.SelectedItems,
Minute: MinuteValue1.SelectedItems
}
)
);
// Step 3: Convert the input times into Time format
Set(varStartTime, Time(Value(Left(StartTimeSelector_lbl2_2.Text, 2)), Value(Mid(StartTimeSelector_lbl2_2.Text, 4, 2)), 0));
Set(varFinishTime, Time(Value(Left(FinishTimeSelector_lbl2_2.Text, 2)), Value(Mid(FinishTimeSelector_lbl2_2.Text, 4, 2)), 0));
// Step 4: Filter based on Support Item Name and Time
If(
StartsWith(NDISSupportItem.Selected.Value, "Access Community") &&
EndsWith(NDISSupportItem.Selected.Value, "Standard"),
ClearCollect(
FilteredItems,
Filter(
'Price List 2024-25',
'Support Item Name' = "Access Community Social and Rec Activ - Standard" &&
(
(varStartTime >= StartTime && varStartTime <= EndTime) ||
(varFinishTime >= StartTime && varFinishTime <= EndTime) ||
(varStartTime < StartTime && varFinishTime > EndTime)
)
)
);
// Step 5: Collect the Filtered Items into QuoteDataCollection
ForAll(
FilteredItems,
Collect(
QuoteDataCollection,
{
'NDIS Number': SupportItemNumber.Value,
Service: SelectedService.Value,
Day: FormattedDaysTable,
Occurrence: Occurrence.Selected,
Year: QuoteYear.Selected,
Frequency: QuoteFrequency.Selected,
'Custom Frequency': CustomFrequency.Value,
'Service Start': Text(DateValue(ServiceStart.SelectedDate)),
'Service End': Text(DateValue(ServiceEnd.SelectedDate)),
Weeks: QuoteWeeks.Value,
'Start Time': StartTimeSelector_lbl2_2.Text,
'Finish Time': FinishTimeSelector_lbl2_2.Text,
Hours: Value(Hours.Value) * QuoteWeeks.Value,
'NDIS Support Item': ThisRecord.'Support Item Name', // Use the filtered item's Support Item Name
Ratio: RatioSelector.Selected.Value,
Rate: Text(Value(SupportRate.Value), "[$-en-US]#0.00"),
'Custom Rate': CustomRate.Value,
'Num Staff': NumOfStaff.Value,
Desc: QuoteDesc.Value,
Assigned: AssignedStaff.Value,
Total: Text(Value(QuoteTotal.Value), "[$-en-US]#0.00"),
CompDate: DateValue1.SelectedDate,
UserMail: UserMail.Value,
Hour: HourValue1.SelectedItems,
Minute: MinuteValue1.SelectedItems
}
)
);
// Step 6: Reset the ComboBox and relevant controls
Reset(NDISSupportItem);
);
// Set FormattedDaysTable and submit the form
Set(FormattedDaysTable, ForAll(QuoteDay.SelectedItems, { Value: Value }));
// Notify user of success (optional)
Notify("Data has successfully been added to the Quote", NotificationType.Success);
// Reset the form and controls (optional)
ResetForm(QuoteDataForm);
Reset(StartTimeSelector_2);
Reset(FinishTimeSelector_2);
Reset(Hours);
I hope this is clear. Apologies if its a lot of information