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

If Statement

Hello,

 

 

I have one box (supply fan unit rate)  that depends on the selected choices of the previous boxes (supply fan KW and the supply fan make) figure 1, the source of these 2 boxes is a database in excel sheet. What I'm trying to do is to  convert the below table into if statement code, when I added the Delta code to Schneider  it gave me zeros. Is there anyway I can link between the codes or should I write it as one code without separation since I have multiple brands and sizes.

 

 

If statement oodeIf statement oodeDatabase tableDatabase tableFigure 1Figure 1 

7 REPLIES 7
C-Papa
Super User
Super User

Hi, i would collect your excel spreadsheet into a collection. you can then change the data card default value to a lookup to the collection. 

 

e.g.

IF(DataCardValue396.Selected.Value = "Schneider",

LookUp([NewCollectionName], Schneider = DataCardValue395.Selected.Value).Schneider)

Thank you for replying @C-Papa ,

 

Can you explain more, I didn't understand the collection part.

I think it would be the same because as i have multiple capacities and brands.

 

C-Papa
Super User
Super User

i mean save your excel to a datasource, this could be excel online or SharePoint / Dataverse etc. then make a connection to your datasource within PowerApps and collect the data to a collection using the ClearCollect function. This will read the data into PowerApps where you can then use the above to lookup the correct values based on the formula

 

C-Papa
Super User
Super User

This would also work but i would personally collect the data.

 

add the below to the datacard default value, you will need to change the values for Delta

 

IF(DataCardValue396.Selected.Value = "Schneider",

Switch(DataCardValue396.Selected.Value,

1.5,1041,

2.2,1193,

3,1347,

4,1504,

5.5,1735,

7.5,2324,

9,3275,

11,3275,

15,3950,

18.5,5022,

22,6648,

30,7648)

,

IF(DataCardValue396.Selected.Value = "Delta",

Switch(DataCardValue396.Selected.Value,

1.5,1041,

2.2,1193,

3,1347,

4,1504,

5.5,1735,

7.5,2324,

9,3275,

11,3275,

15,3950,

18.5,5022,

22,6648,

30,7648)

))

 

Hi @C-Papa,

 

I'm new to PowerApp, can you please help me to write the collection function?

My output depends on 3 items brand, fan type and size.

so I need to check is it supply fan or supply & return then the brand and the size.

 

Do I need to separate below tables into 2 sheets or i can save as 1 excel sheet?

 

 

Screenshot (238).png

Hi @C-Papa ,

 

I've tried this way but I'm getting an error.

this is the formula : IF(DataCardValue396.Selected.value = "Schneider", LookUp([Collection2], Schneider = DataCardValue395.Selected.value).Schneider).

 

Screenshot (239).png

C-Papa
Super User
Super User

Hi, I would suggest the below video from Shane Young, he has a whole series of learning videos on YouTube, i think it would be worth you having a watch of as many as you can to get an understanding of what is going on. For example, in your code above you have a space between . and 'Value', this is incorrect formula syntax and will cause errors straight away regardless if the formula is right.  You need to understand the basics so you have the confidence to create something that will work. 

 

Working with a PowerApps Collection - YouTube

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,671)