cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rkocher
Level: Power Up

Multiple IF statements within a Collect statement

Does PowerApps allow for multiple IF statements within a Collection?

 

Basically, I am collecting information through multiple drop downs. Users need the ability to either select a value from a drop-down or click a checkbox, which then allows the user to enter in text. I need the ability to collect values for either from the drop down or from the text input (depending on IF the checkbox is selected) 

 

**Note not all drop down values have a checkbox, only the ones specified in the code below**

 

 

Collect(AppCollectionCreate, {Title: "Created_Skill",Employee_x0020_Name: 'CS.Name_value'.Text,Skill_x0020_Category: 'CS.SkillCat_drop'.Selected.Value,Skill_x0020_Subcategory: If('CS.SubCat_check' = true, 'CS.SkillSubCat_textimput'.Text, 'CS.SkillSubCat_drop'.Selected.Value),Skill: If('CS.Skill_Check' = true, 'CS.Skill_textimput'.Text, 'CS.Skill_drop'.Selected.Value),Vendor: If('CS.Vendor_Check' = true, 'CS.vendor_textimput'.Text, 'CS.vendor_drop'.Selected.Value),Product: If('CS.Product_Check' = true, 'CS.Product_Textimput'.Text, 'CS.Product_drop'.Selected.Value), Proficiency: 'CS.proficiency_drop'.Selected.Value, Admin_Approval: "Yes"})

 

1 REPLY 1
Community Support Team
Community Support Team

Re: Multiple IF statements within a Collect statement

 

ClearCollect(AppCollectionCreate, 
 {                   Title: "Created_Skill",
       Employee_x0020_Name: 'CS.Name_value'.Text,
      Skill_x0020_Category: 'CS.SkillCat_drop'.Selected.Value,
   Skill_x0020_Subcategory: If('CS.SubCat_check' = true, 'CS.SkillSubCat_textimput'.Text, 'CS.SkillSubCat_drop'.Selected.Value),
                     Skill: If('CS.Skill_Check' = true, 'CS.Skill_textimput'.Text, 'CS.Skill_drop'.Selected.Value),
                    Vendor: If('CS.Vendor_Check' = true, 'CS.vendor_textimput'.Text, 'CS.vendor_drop'.Selected.Value),
                   Product: If('CS.Product_Check' = true, 'CS.Product_Textimput'.Text, 'CS.Product_drop'.Selected.Value), 
               Proficiency: 'CS.proficiency_drop'.Selected.Value, 
            Admin_Approval: "Yes"})

Yes, PowerApps allow for multiple if statements for every elements within the collection.

It is recommended to switch to ClearCollect for you to compare the collection difference with different conditions.

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,491)