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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

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.

I have the same question (0)
  • Verified answer
    SkiDK Profile Picture
    1,016 on at
    Re: Error using IF statement in COLLECTION

    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
    Re: Error using IF statement in COLLECTION

    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
    Re: Error using IF statement in COLLECTION

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 663 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 398 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 235

Last 30 days Overall leaderboard