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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple datasources i...
Power Apps
Answered

Multiple datasources if condition

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying to add a condition when setting a datasource. I have embedded a form into a power app and have done the following to the datasource:

If(!IsBlank(Param("RiskID")), 
 If(VarShortNameTemp = "AI", 'Asphalt & Industrial Products, Retail, BD & TSL');
 If(VarShortNameTemp = "AP", 'Asia Pacific');
 If(VarShortNameTemp = "AR", 'Atlantic Region');
 If(VarShortNameTemp = "CG", 'Corporate Groups');
 If(VarShortNameTemp = "CT", 'Canadian Manufacturing & Technical Services');
 If(VarShortNameTemp = "CO", 'Corporate & Operations Technical Services');
 If(VarShortNameTemp = "CC", 'Canadian Thermal & CHO');
 If(VarShortNameTemp = "MP", 'Major Projects');
 If(VarShortNameTemp = "MO", 'Midstream Operations');
 If(VarShortNameTemp = "UR", 'US Refining');
 If(VarShortNameTemp = "WC", 'Well Delivery & Conventional');
)

This would be great but of course the code has a squiggly red line informing me that the "The function 'IF' has some invalid arguments. true_value: An expression that provides the result of If when the condition is true."

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    Why have all these datasources with identical fields when you could have just one with a field for region?

  • Verified answer
    v-liwei-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous 

     

    The problem is that your formula is written incorrectly, please use the nested If function.
    For example:

     

    If(!IsBlank(Param("RiskID")),If(VarShortNameTemp = "AI", 'Asphalt & Industrial Products, Retail, BD & TSL',If(VarShortNameTemp = "AP",'Asia Pacific',If(VarShortNameTemp = "AR", 'Atlantic Region',If(VarShortNameTemp = "CG", 'Corporate Groups',If(VarShortNameTemp = "CT", 'Canadian Manufacturing & Technical Services'))))))

     

    Best Regards,

    Levi

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Because i like to make my life difficult, hehehe. It was because of security, numbering and eventual load. Each area represents a different area of the business and they wanted to be separate. I tried to make it work all in one but i got overruled

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 421 Most Valuable Professional

#2
11manish Profile Picture

11manish 153 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 116 Super User 2026 Season 2

Last 30 days Overall leaderboard