web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Intermittent data loss...
Power Apps
Unanswered

Intermittent data loss issue

(0) ShareShare
ReportReport
Posted on by 93
Default:  
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.
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    52,906 Super User 2025 Season 2 on at
    Intermittent data loss issue
     
    In your Onchange you have varResNovValue which you are resetting to the Null, but right after that you patch which is fine, but in your Default you are then reloading data, and that data will either be the value of varResNovValue or the value of the colRowMonthData or the ThisItem
     
    Either way patching will not clear the data it will load something back in your default because even though the variable was set to blank the data loading in the Default is not (because it does not use just the variable value) it uses multiple possible values.
     
    I don't think you are losing data, you are simply loading data and default is showing it.

    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 819 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 308 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 222 Super User 2025 Season 2

Last 30 days Overall leaderboard