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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / save previous value wh...
Power Apps
Answered

save previous value when changing to a new value

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

What I have:

several textboxes on a screen(not a form).

The textboxes get their Default value from a datatable..  i.e.  tbl_SkuDetail_1.Selected.SKU

If a person makes a change to a textbox, i need to preserve this previous value and then also record the new value that has been changed.

 

here is my my Patch code for the OnChange event Function.

Patch('[dbo].[t_redbook_pricing_escalation_ChangeLog_Detail]',Defaults('[dbo].[t_redbook_pricing_escalation_ChangeLog_Detail]'),
{
RBP_MASTER_ID: Value(RBK_EscalationId_txt.Text),
FIELD_CHANGED: RBK_Sku_txt.Text,
OLD_VALUE: Value(RBK_Qty_txt.Text),
NEW_VALUE: RBK_Description_txt.Text,
CHANGED_BY_RACFID: txt_QS_RACFID.Text,
CHANGED_BY_NAME: User().FullName,
CHANGED_BY_DATE: Now()

}
)

 

Thanks

Dave

 

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Is there an actual problem or question you have?

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Yes, an issue.

    But I think I figured it out.

    When a screen becomes visible: "OnVisible" I will set a variable for the current Value on a textbox.

    Set(varSkuDetail,RBK_Sku_txt.Text)

     

    In the actual textbox for the "OnSelect" event I will use:

    UpdateContext({varSkuDetail:RBK_Sku_txt.Text});  this will record additional changes if a uses has typos and simply changes the value again.

     

    Then on the "OnChange" event of the textbox i can then use the Updated Context of the variable varSkuDetail used in the "OnSelect"

     

    Patch('[dbo].[t_redbook_pricing_escalation_ChangeLog_Detail]',Defaults('[dbo].[t_redbook_pricing_escalation_ChangeLog_Detail]'),
    {
    RBP_MASTER_ID: Value(RBK_EscalationId_txt.Text),
    FIELD_CHANGED: "Sku",
    OLD_VALUE: varSkuDetail,
    NEW_VALUE: RBK_Sku_txt.Text,
    CHANGED_BY_RACFID: txt_QS_RACFID.Text,
    CHANGED_BY_NAME: User().FullName,
    CHANGED_BY_DATE: Now()
    }
    )

    This is retaining the previous value even if a person keeps retyping any corrected values..

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 510

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 292

Last 30 days Overall leaderboard