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 / Patch Function Error
Power Apps
Answered

Patch Function Error

(0) ShareShare
ReportReport
Posted on by 35

HI All

 

I have an issue with my Patch statement.  I have a collection display in some fields, one of the fields I can edit.  I then want to patch that field value and second field with default text to my collection.  I have a single form.

 

Patch(colPEG_Members, Lookup(colPEG_Members, Value(col_Index) = Value(varRowNum)),{Member_Status: drpAccess.Selected.Value, Record_Status: "Yes"})

 

I am getting the error The function 'Value' has some invalid arguments 

 

The lookup is working correctly for me to find the unique record and display field values eg

LookUp(colPEG_Members, Value(col_Index) = Value(varRowNum)).Review_Date

 

Any assistance would be appreciated

 

Marty

 

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,762 Most Valuable Professional on at

    Hi @McKennaM03 ,

    Firstly is varRowNum a numeric value - if so, you do not need Value() around it. Also, what are the Items of drpAccess?

  • McKennaM03 Profile Picture
    35 on at

    HI @WarrenBelz 

     

    Yes varRowNum is a whole number as the number of the collection record selected in the screen.  col_Index is a field in the collection with a whole number for the record number.  I needed to add the Value function to make my lookup function work  

     

    drpAccess Items are ["Yes", "No"]

     

     

     

  • WarrenBelz Profile Picture
    155,762 Most Valuable Professional on at

    Hi @McKennaM03 ,

    There are only three "Value" references in there (which is what the error is saying), so one has to be causing the error. If the Items of drpAccess are  ["Yes", "No"], then the correct reference is definitely drpAccess.Value.

    This only leaves col_PEGMembers.col_index and varRowNum. When Value() is used around a reference, it is expected to be a number stored as Text. If the reference is Numeric, then Value() is not needed as it is already a number.

    So please check exactly what col_PEGMembers.col_index and varRowNum contain. If they are both numbers, try without Value() around them.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • McKennaM03 Profile Picture
    35 on at

    HI @WarrenBelz 

     

    I declare varRowNum in the App OnStart method like this,  which I assume defines it as a whole number

    Set(varRowNum, 1);

     

    I create the filtered collection colPEG_ZMembers from a dataverse table.  I then create a second collection colPEG_Members adding the col_Index column to number the records.

     

    ForAll(colPEG_ZMembers,
    Collect(colPEG_Members,
    Patch(Last(FirstN(colPEG_ZMembers, CountRows(colPEG_Members)+1)),
    {col_Index: CountRows(colPEG_Members) + 1})));

     

    After removing the Value function from both, the error changes to Incompatible types for comparison.  These types cant be compared:  Error, Number

     

    Marty

     

     

     

     

     

     

  • WarrenBelz Profile Picture
    155,762 Most Valuable Professional on at

    @McKennaM03 

    It is good to state your data source  - I am a SharePoint user, which is probably why it makes no sense to me why it does not work.

  • Verified answer
    McKennaM03 Profile Picture
    35 on at

    @WarrenBelz 

    Thanks I've solved my problem

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard