web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can Someone identify t...
Power Apps
Unanswered

Can Someone identify the error in ths code ?

(0) ShareShare
ReportReport
Posted on by 48
i cannot find the error in this code .
error message: invalid number of arguments: received 3, expected 2.
code: onSelect=
Set(
    createdRecordID,
    Patch(
        List_Orders,
        Gallery1.Selected,
        {
            Title: Text(DDCustomer.SelectedText.Title),
            Adress: L_Adresse.Text,
            Delivered: Toggle1.Value,
            Paid: Toggle2.Value
        }
    ).ID
);
ForAll(//invalid number of arguments: received 3, expected 2.
    Gallery_orders.AllItems,
        If(
        Value(ThisRecord.TI_Amount_1.Text) = 0,
        Remove(
            SubList_Orderd,
            LookUp(
                SubList_Orderd,
                Title = ThisRecord.Title && OrderID = createdRecordID
            )
        )
    ),

    If(
        Value(ThisRecord.TI_Amount_1.Text) > 0,
        Patch(
            SubList_Orderd,
            Defaults(SubList_Orderd),
            {
                OrderID: createdRecordID,
                Title: TitleLabel.Text,
                Cost: Value(PriceLabel.Text) * Value(TI_Amount.Text),
                'Requested Amound': Value(TI_Amount.Text)  // typo is also writen like this in the list 
            }
        ),
       
    )
)
Categories:
I have the same question (0)
  • Wolfdrano Profile Picture
    48 on at

    i have rebuild the entire screen and now use a differend code . so i nolonger need help with this code . thx for  the help nontheless

  • WarrenBelz Profile Picture
    153,477 Most Valuable Professional on at

    @Wolfdrano ,

    Another perspective - assuming all those controls are in the gallery, does this work ?

    Set(
     createdRecordID,
     Patch(
     List_Orders,
     Gallery1.Selected,
     {
     Title: DDCustomer.Selected.Title,
     Adress: L_Adresse.Text,
     Delivered: Toggle1.Value,
     Paid: Toggle2.Value
     }
     ).ID
    );
    ForAll(
     Gallery_orders.AllItems As _Data,
     If(
     Value(_Data.TI_Amount_1.Text) = 0,
     Remove(
     SubList_Orderd,
     LookUp(
     SubList_Orderd,
     Title = _Data.Title && OrderID = createdRecordID
     )
     ),
     Value(_Data.TI_Amount_1.Text) > 0,
     Patch(
     SubList_Orderd,
     Defaults(SubList_Orderd),
     {
     OrderID: createdRecordID,
     Title: _Data.TitleLabel.Text,
     Cost: Value(_Data.PriceLabel.Text) * Value(_Data.TI_Amount.Text),
     'Requested Amound': Value(_Data.TI_Amount.Text) 
     }
     )
     ) 
    )
  • Wolfdrano Profile Picture
    48 on at

    the typo is both in code and in the list so it has no real impact ... but ill change it 

    as expected it doesent fix the code  

     

  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @Wolfdrano can you tru this: 

    OnSelect =
     Set(
     createdRecordID,
     Patch(
     List_Orders,
     Gallery1.Selected,
     {
     Title: Text(DDCustomer.SelectedText.Title),
     Address: L_Address.Text, // Corrected typo "Address"
     Delivered: Toggle1.Value,
     Paid: Toggle2.Value
     }
     ).ID
     );
    ForAll(
     Gallery_orders.AllItems,
     If(
     Value(ThisRecord.TI_Amount_1.Text) = 0,
     Remove(
     SubList_Orderd,
     LookUp(
     SubList_Orderd,
     Title = ThisRecord.Title && OrderID = createdRecordID
     )
     ),
     If(
     Value(ThisRecord.TI_Amount_1.Text) > 0,
     Patch(
     SubList_Orderd,
     Defaults(SubList_Orderd),
     {
     OrderID: createdRecordID,
     Title: TitleLabel.Text,
     Cost: Value(PriceLabel.Text) * Value(TI_Amount.Text),
     'Requested Amount': Value(TI_Amount.Text) // Corrected typo "Amount"
     }
     )
     )
     )
    )

    Please click Accept as solution if my post helped you solve your issue. ✔️ This will help others find the solution to this problem. It also closes the item. Remember, you can accept more than one post as a solution.

    If the content was useful in other ways, please consider giving it Thumbs Up. 👍

    Thanks
    Andrew

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 400

#2
WarrenBelz Profile Picture

WarrenBelz 348 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 315 Super User 2025 Season 2

Last 30 days Overall leaderboard