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

 

View solution in original post

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,429)