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 / 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)
  • 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

  • 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  

     

  • WarrenBelz Profile Picture
    154,547 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

    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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 509 Most Valuable Professional

#2
Haque Profile Picture

Haque 302

#3
11manish Profile Picture

11manish 265

Last 30 days Overall leaderboard