cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

How to add 1 to a number every time an item is edited

Hi all,

 

I am looking to realise how many times an item has been edited in total.

 

I am thinking to have a column called "Revised" and simply have the Datacards default property: N+1 (starting from -1 so that it would be on 0 after first submitting the new form)

 

How is this possible?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: How to add 1 to a number every time an item is edited

Hi @AndersIskov 

 

To configure this, can you try to create new field of type "Number" and set its value to default as 0. Let say you named this field as "EditCount".

When you are editing the records, you can pass the values accordingly as:

If you are using Patch to save the values:
Patch(DataSource, LookUp(DataSource, ColumnName = "Value"), { EditCount: LookUp(DataSource, ColumnName = "Value").EditCount + 1})
Note: Whatever you are passing to identify the record, the same needs to be passed to extract the EditCount Variable.


If you are using edit forms, then you can update the "Update" property of the field as:
If(FormName.Mode = FormMode.Edit, Value(ThisItem.EditCount) + 1, DataCardValue12.Text)

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Community Champion
Community Champion

Re: How to add 1 to a number every time an item is edited

Hi @AndersIskov ,

Have the column you suggest and:-

  1. Do a lookup and create a Global numeric variable from the column at App start
  2. Each time the SubmitForm or Patch, add 1 to this Variable first and Patch this at the same time
    (or have a custom card based on the field with a label showing the variable number and submit this in the update properties of the form if that is what you are using)

 

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up.

View solution in original post

2 REPLIES 2
Highlighted
Dual Super User
Dual Super User

Re: How to add 1 to a number every time an item is edited

Hi @AndersIskov 

 

To configure this, can you try to create new field of type "Number" and set its value to default as 0. Let say you named this field as "EditCount".

When you are editing the records, you can pass the values accordingly as:

If you are using Patch to save the values:
Patch(DataSource, LookUp(DataSource, ColumnName = "Value"), { EditCount: LookUp(DataSource, ColumnName = "Value").EditCount + 1})
Note: Whatever you are passing to identify the record, the same needs to be passed to extract the EditCount Variable.


If you are using edit forms, then you can update the "Update" property of the field as:
If(FormName.Mode = FormMode.Edit, Value(ThisItem.EditCount) + 1, DataCardValue12.Text)

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Community Champion
Community Champion

Re: How to add 1 to a number every time an item is edited

Hi @AndersIskov ,

Have the column you suggest and:-

  1. Do a lookup and create a Global numeric variable from the column at App start
  2. Each time the SubmitForm or Patch, add 1 to this Variable first and Patch this at the same time
    (or have a custom card based on the field with a label showing the variable number and submit this in the update properties of the form if that is what you are using)

 

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (11,043)