cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dobroo
Resolver I
Resolver I

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
Super User

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
Super User

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
Super User

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)
    )
)

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

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,868)