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 / Error using IF stateme...
Power Apps
Unanswered

Error using IF statement in COLLECTION

(0) ShareShare
ReportReport
Posted on by 383

Hi Power Apps Community,

I am trying to create a collection of the items in a Gallery.

Issue: The values which I am trying to collect are from two controls (Radio and Text). Depending on the control used, I would like to collect the relevant data. As seen below, I have been trying to incorporate the IF statement in the Collection.

ForAll(Gallery.AllItems,
 Collect(CollectionName,
 {Field1:Title.Text,
 Field2: If('Field' = "Value", Radio.Selected.Value, TextInput.Text}));

 I would appreciate any help.

Thank you in advance.

Categories:
I have the same question (0)
  • Verified answer
    SkiDK Profile Picture
    1,016 on at

    Hi @Data_Enthusiast 

    There is a mistake in your syntax. You don't close the if statement.

    ForAll(
     Gallery.AllItems,
     Collect(
     CollectionName,
     {
     Field1: Title.Text,
     Field2: If('Field' = "Value", Radio.Selected.Value, TextInput.Text)
     }
     )
    );

     

  • Data_Enthusiast Profile Picture
    383 on at

    Hi @SkiDK 

    Thank you for the response.

    When adding your update, I get the following issue:

    Data_Enthusiast_0-1602158348777.png

    Seems to not like the equal sign.

  • Data_Enthusiast Profile Picture
    383 on at

    Hi @SkiDK 

    Please ignore the previous comment. I made a mistake on my side. Your formula provided does work 😀

    I guess it does not help that I rush 😅

    Thank you for the help.

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
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard