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 / invalid number of argu...
Power Apps
Answered

invalid number of arguments: received4, expected 2

(0) ShareShare
ReportReport
Posted on by 114

Hello,
Below is my code:

ForAll(
 SPMeetings,
 {
 //Check if an entry already exists in coldata with the same combination of Project, NewMeetingType, MeetingDate, Dateline, and PIC
 If(
 CountRows(
 Filter(
 coldata,
 Project = ThisRecord.Project &&
 NewMeetingType = ThisRecord.NewMeetingType &&
 MeetingDate = ThisRecord.MeetingDate &&
 Dateline = ThisRecord.Dateline &&
 PIC = ThisRecord.PIC
 )
 ) > 0,
 // If an entry exists, update it with the new Description and Action Item
 UpdateIf(
 coldata, // Collection to update
 Project = ThisRecord.Project &&
 NewMeetingType = ThisRecord.NewMeetingType &&
 MeetingDate = ThisRecord.MeetingDate &&
 Dateline = ThisRecord.Dateline &&
 PIC = ThisRecord.PIC, // Condition to identify the item to update
 {
 Description: ThisRecord.Description, // Update the Description field
 ActionItem: ThisRecord.ActionItem // Update the Action Item field
 // You can add more fields to update if needed
 }
 ),
 // If no entry exists, add a new entry
 Collect(
 coldata,
 {
 Project: ThisRecord.Project,
 NewMeetingType: ThisRecord.NewMeetingType,
 MeetingDate: ThisRecord.MeetingDate,
 Dateline: ThisRecord.Dateline,
 PIC: ThisRecord.PIC,
 Description: ThisRecord.Description, // Add the Description field
 ActionItem: ThisRecord.ActionItem // Add the Action Item field
 }
 )
 )
 }
);

I got an error in ForAll() that says the function expected 2 arguments but received 4 in return. i cant seem to figure out what went wrong

Thank you in advance ! 

Categories:
  • Verified answer
    Gochix Profile Picture
    1,937 Moderator on at

    @lumos ,

    Remove first brackets {}.

    ForAll(
     SPMeetings,
     //Check if an entry already exists in coldata with the same combination of Project, NewMeetingType, MeetingDate, Dateline, and PIC
     If(
     CountRows(
     Filter(
     coldata,
     Project = ThisRecord.Project &&
     NewMeetingType = ThisRecord.NewMeetingType &&
     MeetingDate = ThisRecord.MeetingDate &&
     Dateline = ThisRecord.Dateline &&
     PIC = ThisRecord.PIC
     )
     ) > 0,
     // If an entry exists, update it with the new Description and Action Item
     UpdateIf(
     coldata, // Collection to update
     Project = ThisRecord.Project &&
     NewMeetingType = ThisRecord.NewMeetingType &&
     MeetingDate = ThisRecord.MeetingDate &&
     Dateline = ThisRecord.Dateline &&
     PIC = ThisRecord.PIC, // Condition to identify the item to update
     {
     Description: ThisRecord.Description, // Update the Description field
     ActionItem: ThisRecord.ActionItem // Update the Action Item field
     // You can add more fields to update if needed
     }
     ),
     // If no entry exists, add a new entry
     Collect(
     coldata,
     {
     Project: ThisRecord.Project,
     NewMeetingType: ThisRecord.NewMeetingType,
     MeetingDate: ThisRecord.MeetingDate,
     Dateline: ThisRecord.Dateline,
     PIC: ThisRecord.PIC,
     Description: ThisRecord.Description, // Add the Description field
     ActionItem: ThisRecord.ActionItem // Add the Action Item field
     }
     )
     )
    );


    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

  • lumos Profile Picture
    114 on at

    Thank you for responding @Gochix !
    there's another one :

    lumos_0-1715824833089.png

    I'm very confused when it comes to this kind error : 
    incompatible types for comparison. These types cant be compared : Record, Record

  • lumos Profile Picture
    114 on at

    its okay, i figured out , need to add .value

  • Gochix Profile Picture
    1,937 Moderator on at

    @lumos ,

    Glad it fixed the original issue. If I have answered your original question, please accept the solution to close the topic.
    _____________________________________________________________________________________
    Please give a thumbs up if I resolved your issue! Please click Accept as Solution to close the topic!

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard