cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
12strikes
Frequent Visitor

If statement in a Patch command

I have an app for inventory.

The user updates the "FYTD_Planned Units", and "FYTD Actual Units" (FYTD = Fiscal Year To Date) But the user is not allowed to update the "FY Planned Units".  I need to change the app so that only certain records the user can update the "FY Planned Units".  But they will only be allowed to update the "FY Planned Units" with the "FYTD Actual Units".   So what I did was add a column on my SharePoint list (the data source for this app) called OVERRIDE (a YES/NO field)
I'm trying to put together an IF statement where if Override = Yes the patch statement will update 'FYTD ACTUAL Units' and 'FY Plan Units' (on my SharePoint list) with FYTD_Actuals.text  Else just updated 'FYTD ACTUAL UNITS ' with FYTD_Actual.txt.


My Current Patch:

Patch(FY2020_MajorProd_PM_Update,ThisItem,{LastUpdated:Today()},{USER:User().FullName},{'FYTD Actual Units': FYTD_ACTUALS.Text},{'FYTD Planned Units': FYTD_PLANNED.Text},{Comments:COMMENTS.Text},{'Project Complete':Toggle3.Value})


I can't figure it out.... 
Please help.




2 REPLIES 2
Drrickryp
Super User
Super User

@12strikes 

A couple of observations:  all SharePoint lists already have a Modified (Date type) and ModifiedBy field in the list that is metadata.  It is automatically assigned and can be referenced but cannot be changed.   That doesn't prevent  you from manually putting the same data as a field in your list but it seems redundant. 

I strongly advise against using Yes/No column types in SharePoint.  Just change it to a single line of text type.  You can control the data saved by just using a checkbox or toggle control.  It will save a value as either true or false and it will be easier to filter your lists according to that value.  

Thanks for the reply but that did not really answer my question... 
This override is not going to be a toggle on the app. It's not for general consumption that the option is available.
I need to update my patch statement
thanks

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (2,731)