cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FlatFish
Helper II
Helper II

200+ conditional if statement

Hi everyone,

 

I have a giant nested if statement that would require a ton of ifs. Does anyone know a better alternative to doing it rather than this. Regardless having such a big if statement isn't allowed anyway. 

Here is an example of one of the ifs that would continue for different users/banks etc.

If(emailToDropdown.Selected.Title = "fName lName" && bankSelectionDropDown.Selected.Title = "Bank" && userSelectDropDown.Selected.Title = "DS" && bankAccountTypeDropDown.Selected.Title = "Transactional" && accountOptionDropDown.Selected.Title = "Open an Account",
                                    Launch("mailto:fName.lName@email.com" & "?subject= New account opening Bank" & "&body=Hi fName," & "%0A" & "%0A" & "In connection with the new account opening at Bank, attached please find account opening documents submitted for signature." & "%0A" & "Bank accepts docusign" & "%0A" & "%0A" & "Please let me know if you have any questions regarding this request." & "%0A" & "%0A" & "Kind regards"),

 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @FlatFish 

An alternative would be to store your email message templates in a table. This could be in an online data source like a SharePoint list, or it could be a static Excel file that you import into your Power App.

 

This table would include user and bank columns, and you would use those details to uniquely identify the message text.

 

From the button where you currently launch your email, you would call LookUp on this table to lookup the message text template, rather than construct the message text using an If.

 

The message text that you store in this table could contain placeholders such as "{fName}" and from your formula, you could call the Substitute function to insert the actual data values.

View solution in original post

3 REPLIES 3
timl
Super User
Super User

Hi @FlatFish 

An alternative would be to store your email message templates in a table. This could be in an online data source like a SharePoint list, or it could be a static Excel file that you import into your Power App.

 

This table would include user and bank columns, and you would use those details to uniquely identify the message text.

 

From the button where you currently launch your email, you would call LookUp on this table to lookup the message text template, rather than construct the message text using an If.

 

The message text that you store in this table could contain placeholders such as "{fName}" and from your formula, you could call the Substitute function to insert the actual data values.

Thank you for the reply Tim. That makes sense and will be most likely what I do. 

timl
Super User
Super User

You're welcome @FlatFish - the other benefit of storing the template text in an online table is that you could modify the message text without needing to republish your app.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,567)