If(
CountRows(
Filter(
colRowMonthData,
UnitType = 0
)
) = 0,
ForAll(
colRowMonthData As Alpha,
With(
{ isNumberUnit: Alpha.Unit <> Unit.text,
isTextUnit: Alpha.Unit = Unit.text,
tempObjRecord: LookUp(colMyTempObjective, 'Objective ID' = Alpha.'Objective ID'),
ResultJanText:Alpha.ResultJan.Text,
YTDJanText:Alpha.YTDJan.Text,
ResultFebText:Alpha.FebResult.Text,
YTDFebText:Alpha.FebYTD.Text,
ResultMarText:Alpha.ResultMar.Text,
YTDMarText:Alpha.YTDMar.Text,
ResultAprText:Alpha.ResultApr.Text,
YTDAprText:Alpha.YTDApr.Text,
ResultMayText:Alpha.ResultMay.Text,
YTDMayText:Alpha.YTDMay.Text,
ResultJuneText:Alpha.ResultJun.Text,
YTDJunText:Alpha.YTDJun.Text,
ResultJulyText:Alpha.ResultJul.Text,
YTDJulText:Alpha.YTDJul.Text,
ResultAugText:Alpha.ResultAug.Text,
YTDAugText:Alpha.YTDAug.Text,
ResultSepText:Alpha.ResultSep.Text,
YTDSepText:Alpha.YTDSep.Text,
ResultOctText:Alpha.ResultOct.Text,
YTDOctText:Alpha.YTDOct.Text,
ResultNovText:Alpha.ResultNov.Text,
YTDNovText:Alpha.YTDNov.Text,
ResultDecText:Alpha.ResultDec.Text,
YTDDecText:Alpha.YTDDec.Text},
Patch(
Objectives,
LookUp(colMyTempObjective, 'Objective ID' = Alpha.'Objective ID'),
{
'Result jan': If(
Alpha.Unit <> Unit.text,
Value(ResultJan.Text),
Blank()
),
'Result jan t': If(
Alpha.Unit = Unit.text,
ResultJan.Text,
Blank()
),
'YTD jan': If(
Alpha.Unit <> Unit.text,Value(YTDJan.Text),
Blank()
),
'YTD jan t': If(
Alpha.Unit = Unit.text,
YTDJan.Text,
Blank()
),
'Comment (itobj_jan_comment)':ComJan.Text,
Frequency: Alpha.Frequency,
Textinput onchange:
If(
CountRows(Filter(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID')) = 0,
// Add new record if it doesn't exist
Collect(
colRowMonthData,
AddColumns(
Gallery2_4.Selected,
IsChanged,
1,
UnitType,
If(
IsNumeric(Self.Text) && Text(ThisItem.Unit) <> "text" ,
1,
Text(ThisItem.Unit) = "text",
1,
IsBlank(Self.Text),
1,0
)
)
),
// Use Patch to update the record if it exists
Patch(
colRowMonthData,
LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID'),
AddColumns(
Gallery2_4.Selected,
IsChanged,
1,
UnitType,
If(
IsNumeric(Self.Text) && Text(ThisItem.Unit) <> "text" ,
1,
Text(ThisItem.Unit) = "text",
1,
IsBlank(Self.Text),
1,0
)
)
)
);
Patch(colObjectivesData,
ThisItem,
{
'Result jan': If(
ThisItem.Unit <> Unit.text,
Value(Self.Text),
Blank()
),
'Result jan t': If(
ThisItem.Unit = Unit.text,
Self.Text,
Blank()
)
}
);
If(
ThisItem.Unit = Unit.text,true, IsNumeric(Self.Text) || IsBlank(Self.Text),true,UpdateContext({varwarningPopup:true})
);
Default of textinput:
If(IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text),
If(
ThisItem.Unit=(Unit.text),
ThisItem.'Result jan t',
ThisItem.'Result jan' ),LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text)