cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dobroo
Advocate II
Advocate II

Formula error

Hi @ALL,

can someone explain to me where the error lies in this formula:

 

With({_longText:"bigText: iurhfuishdiughsudhgiufhsuhfughufdhgusdhgiufdhughugfhsguhsiu"};
If(_varBool;
    //True Functions
    Set(_VisibleVARBool; false );;
    ClearCollect(colLoopMaster;{Index:0})
    
    ;

    // Otherwise Function
    Set(_shortText;_longText)
    )
)

 

I thought it is possible that you can normally use ";;" for several true functions in an if()-Function.

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @dobroo 

It's possible that Power Apps expects a consistent return value from both the true and false branches of the if statement.

Therefore, if you reverse the function calls in your true branch so that ClearCollect comes first, does the error go away?

 

With({_longText:"bigText: iurhfuishdiughsudhgiufhsuhfughufdhgusdhgiufdhughugfhsguhsiu"};
If(_varBool;
    //True Functions
    ClearCollect(colLoopMaster;{Index:0});;
    Set(_VisibleVARBool; false )
    ;
    // Otherwise Function
    Set(_shortText;_longText)
    )
)

View solution in original post

3 REPLIES 3
Drrickryp
Super User II
Super User II

Hi @dobroo 

If() will operate on the conditions until it finds the first true condition and then stops and executes the remaining functions.  To get it to consider two conditions simultaneously, you will need to use an "or" or "and" operator depending on whether both conditions are true or one of the two are true.

timl
Super User III
Super User III

Hi @dobroo 

It's possible that Power Apps expects a consistent return value from both the true and false branches of the if statement.

Therefore, if you reverse the function calls in your true branch so that ClearCollect comes first, does the error go away?

 

With({_longText:"bigText: iurhfuishdiughsudhgiufhsuhfughufdhgusdhgiufdhughugfhsguhsiu"};
If(_varBool;
    //True Functions
    ClearCollect(colLoopMaster;{Index:0});;
    Set(_VisibleVARBool; false )
    ;
    // Otherwise Function
    Set(_shortText;_longText)
    )
)

View solution in original post

this is really irritating, i swap the function and it works

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (67,467)