If(
varResNovID = ThisItem.'Objective ID' &&
(!IsBlank(varResNovValue)|| varResNovValue = "") && Text(ThisItem.Frequency)<>"Quarterly",
varResNovValue,
With(
{
rec: LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID')
},
Switch(
Text(ThisItem.Frequency),
"Quarterly",
Coalesce(
Text(rec.ResultSep.Text),
If(
Text(ThisItem.Unit) = "text",
ThisItem.'Result sep t',
If(
IsBlank(ThisItem.'Result sep'),
Text(ThisItem.itobj_resultsepa),
Text(ThisItem.'Result sep')
)
)
),
"Monthly",
Coalesce(
Text(rec.ResultNov.Text),
If(
Text(ThisItem.Unit) = "text",
ThisItem.'Result nov t',
If(
IsBlank(ThisItem.'Result nov'),
Text(ThisItem.itobj_resultnova),
Text(ThisItem.'Result nov')
)
)
),
"Yearly",
Coalesce(
Text(rec.ResultNov.Text),
If(
Text(ThisItem.Unit) = "text",
ThisItem.'Result nov t',
If(
IsBlank(ThisItem.'Result nov'),
Text(ThisItem.itobj_resultnova),
Text(ThisItem.'Result nov')
)
)
),
""
)
)
)
Onchange:
UpdateContext({
varResNovValue: Self.Text,
varResNovID: ThisItem.'Objective ID'
});
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 nov': If(
ThisItem.Unit <> Unit.text,
Value(Self.Text),
Blank()
),
'Result nov 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})
)
when user delete the data in textinput it is reappearing.