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 Apps - Building Power Apps
Suggested answer

data disappears on the controls if we remove reappears

(0) ShareShare
ReportReport
Posted on by 58
I have used this code on textinput default code: 
 
Switch( Text(ThisItem.Frequency),"Quarterly",If(IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text),
If(
    ThisItem.Unit=(Unit.text),
    ThisItem.'Result jan t',
    If(IsBlank(ThisItem.'Result jan'),ThisItem.ResultJanX,ThisItem.'Result jan')
    ),LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text),"Monthly",If(IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text),
If(
    ThisItem.Unit=(Unit.text),
    ThisItem.'Result jan t',
    If(IsBlank(ThisItem.'Result jan'),ThisItem.ResultJanX,ThisItem.'Result jan')
    ),LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text),"Yearly", If(IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text),
If(
    ThisItem.Unit=(Unit.text),
    ThisItem.'Result jan t',
    If(IsBlank(ThisItem.'Result jan'),ThisItem.ResultJanX,ThisItem.'Result jan')
    ),LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJan.Text))
 
textinput onchange property:
 
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})
)
 
 
if users enter the data and come out data will disappear and if users removed the data appear again. please give the solution.
 
Thank you
   
I have the same question (0)
  • RV-16061027-0 Profile Picture
    58 on at
    data disappears on the controls if we remove reappears
    Hi @ 
    Switch( Text(ThisItem.Frequency),"Quarterly",If(IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJun.Text),
    If(
        ThisItem.Unit=(Unit.text),
        ThisItem.'Result jun t',
        If(IsBlank(ThisItem.'Result jun'),ThisItem.ResultJunX,ThisItem.'Result jun')
        ),LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJun.Text),"Monthly",If(IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJul.Text),
    If(
        ThisItem.Unit=(Unit.text),
        ThisItem.'Result jul t',
        If(IsBlank(ThisItem.'Result jul'),ThisItem.ResultJulX,ThisItem.'Result jul')
        ),LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJul.Text),"Yearly", If(IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJul.Text),
    If(
        ThisItem.Unit=(Unit.text),
        ThisItem.'Result jul t',
        If(IsBlank(ThisItem.'Result jul'),ThisItem.ResultJulX,ThisItem.'Result jul')
        ),LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID').ResultJul.Text))
     
     
    i have used above code for july tetxinput in that case what is the code i have to use?
  • Suggested answer
    Nirav Raval (Akira28) Profile Picture
    153 Moderator on at
    data disappears on the controls if we remove reappears
    Hi @RV-16061027-0


    I think you can try the below code with on default.


    Text Input Default - 
     
    With(
        { rec: LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID') },
        Coalesce(
            rec.ResultJan,                                       
            If(
                Text(ThisItem.Unit) = "text",
                ThisItem.'Result jan t',                         
                Text(ThisItem.'Result jan')                      
            )
        )
    )




    Text Input Onchange - 
     
    With({ val: Self.Text },
    
        
        If(
            IsBlank(LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID')),
            Collect(
                colRowMonthData,
                {
                    'Objective ID': ThisItem.'Objective ID',
                    ResultJan: val,
                    IsChanged: true,
                    UnitType:
                        If(
                            Text(ThisItem.Unit) = "text"
                            || IsBlank(val)
                            || (IsNumeric(val) && Text(ThisItem.Unit) <> "text"),
                            1,
                            0
                        )
                }
            ),
            UpdateIf(
                colRowMonthData,
                'Objective ID' = ThisItem.'Objective ID',
                {
                    ResultJan: val,
                    IsChanged: true,
                    UnitType:
                        If(
                            Text(ThisItem.Unit) = "text"
                            || IsBlank(val)
                            || (IsNumeric(val) && Text(ThisItem.Unit) <> "text"),
                            1,
                            0
                        )
                }
            )
        );
    
        
        Patch(
            colObjectivesData,
            ThisItem,
            {
                'Result jan':
                    If(
                        Text(ThisItem.Unit) <> "text" && !IsBlank(val),
                        Value(val),
                        Blank()
                    ),
                'Result jan t':
                    If(
                        Text(ThisItem.Unit) = "text",
                        val,
                        Blank()
                    )
            }
        )
    );



    If this post solved your issue, clicking 'Does this answer your question' will help others discover the solution and close the topic. If you found it helpful, a Like would be awesome!
     
    Regards,
    Nirav J Raval (Akira28) 🤞
  • RV-16061027-0 Profile Picture
    58 on at
    data disappears on the controls if we remove reappears
    Hi @  ,i pasted the default code. giving the error like expected text value. 
  • mmbr1606 Profile Picture
    13,671 Super User 2025 Season 2 on at
    data disappears on the controls if we remove reappears
    hey
     
     
    can u try this Onchange:
    With(
        {
            _id: ThisItem.'Objective ID',
            _val: Self.Text,
            _isText: Text(ThisItem.Unit) = "text"
        },
        // upsert into the local edit buffer
        If(
            IsBlank(LookUp(colRowMonthData, 'Objective ID' = _id)),
            Collect(colRowMonthData, { 'Objective ID': _id, ResultJan: _val }),
            Patch(
                colRowMonthData,
                LookUp(colRowMonthData, 'Objective ID' = _id),
                { ResultJan: _val }
            )
        );
    
        // persist to your main data source
        Patch(
            colObjectivesData,
            ThisItem,
            If(
                _isText,
                { 'Result jan t': _val, 'Result jan': Blank() },
                { 'Result jan': Value(_val), 'Result jan t': Blank() }
            )
        );
    
        // validation / warning
        If(
            _isText || IsNumeric(_val) || IsBlank(_val),
            true,
            UpdateContext({ varwarningPopup: true })
        )
    )
    
    and this default:
    With(
        { rec: LookUp(colRowMonthData, 'Objective ID' = ThisItem.'Objective ID') },
        Coalesce(
            rec.ResultJan,                                  // what the user last typed (in-memory)
            If(
                Text(ThisItem.Unit) = "text",
                ThisItem.'Result jan t',                    // existing text value from DS
                Text(ThisItem.'Result jan')                 // existing numeric value from DS -> text
            ),
            ""
        )
    )
    
     
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 954 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 386 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 364

Last 30 days Overall leaderboard