cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

Adding values during item update

I am currently doing this to add to an existing cumulative value in a SharePoint list:

 

UpdateIf(DataSource, Title = varRecord.Title,
   {
     DevHours: DevHours + Value(TextInputDevelopmentHours.Text)
   }
)

 

I need to make some changes to my overall formula and would like to use Patch instead to avoid any delegation issues down the line.   It doesn't seem that Patch supports this type of adding values together.

 

Is UpdateIf the only function that allows this?   I would rather avoid a lookup to get the current value if at all possible.

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
1 ACCEPTED SOLUTION

Accepted Solutions
Alex_10
Super User
Super User

@JR-BejeweledOne 

there is a typo 

DemoProjectCumulutiveHours
DemoProjectCumulativeHours

 

View solution in original post

5 REPLIES 5
Alex_10
Super User
Super User

@JR-BejeweledOne 

 

what is the datatype for DevHours column? what is the datatype of DevHours parameter that you use to update DevHours column?

Alex_10
Super User
Super User

@JR-BejeweledOne 

if DevHours parameter just updates the DevHours column value of the item:

 

ForAll( RenameColumns(Filter(DataSource, Title = varRecord.Title), "ID", "tempID") As ThisItem,
    Patch(DataSource, LookUp(DataSource, ID = ThisItem.tempID),
        {
        DevHours : ThisItem.DevHours + Value(TextInputDevelopmentHours.Text)
        }
    )
)

I have 2 use cases for this.  One uses varRecord.ID (when editing an item) and what you see below is the 2nd use case.   Not sure where the error is, but I *think* it's before the patch as it's not recognizing the data source name at that point.

 

incompatibletype.png

 

ForAll(
                        RenameColumns(
                            Filter(DemoProjectCumulativeHours,
                            MasterID = ComboBoxProject.Selected.ID && Title = DevName),
                             "MasterID", "tempMID")
                            As ThisItem,
                            Patch(DemoProjectCumulutiveHours,
                                LookUp(DemoProjectCumulutiveHours, MasterID = ThisItem.tempMID),
                                 {
                                     DevHours: ThisItem.DevHours + Value(TextInputDevelopmentHours.Text)
                                    }
                                )
                        
                    )


 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
Alex_10
Super User
Super User

@JR-BejeweledOne 

there is a typo 

DemoProjectCumulutiveHours
DemoProjectCumulativeHours

 

Thank you!   I am waiting on new glasses and when my eyes get really tired, I miss that sort of thing.............



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,038)