Hi @v-qiaqi-msft ,
1. I actually wanted to use the selected values for my global variable which is to trigger a timer to recalculate the amount and update/duplicate the data to my DataSource based on the selected month.
Below is snippet code in my onSelect button:
// update to specified month
UpdateIf(NewRecords, true, {
'Budget Month':LookUp(displayItem.'Budget Months', Month = Switch(Concat(comboBoxMonth.SelectedItems,Value,", "),"January", "1", "February", "2", "March", "3", "April", "4", "May", "5", "June", "6", "July", "7", "August", "8", "September", "9", "October", "10", "November", "11", "December", "12"))
});
// create batch record
Patch('Forecast Items', NewRecords);
//trigger a timer to recalculate the amount based on selected months
Set(MonthToCopy, Concat(comboBoxMonth.SelectedItems,Value,", "));
Set(RecalculateForecast, true);
here is my Timer OnStart property:
UpdateContext({
TotalForTheMonth:Sum(Filter(...),
RecordToUpdate:LookUp('Budget Record', ...)
});
If(IsBlank(MonthToCopy), Set(MonthToCopy, txtMonth));
If(IsBlank(TotalForTheMonth),UpdateContext({TotalForTheMonth:0}));
Switch(MonthToCopy,
"January",Patch('Budget Record',RecordToUpdate,{'Jan Forecast':TotalForTheMonth}),
.........
"December",Patch('Budget Record',RecordToUpdate,{'Dec Forecast':TotalForTheMonth});
);
2. My month column is a text type with value of (1-12)
3. and no my comboBoxMonth Item property is a filter from a Collection which displays the future month based on the current month..(August, September etc...)
For now all my function/formulas are working well but only when user select one month.
Now, my issue is I wanted to be able to select multiple months to duplicate my data and I've realized I might have to loop through the items in comboboxMonth. I am not sure what the best approach and would appreciate the feedback from you about this. Thank you!