cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Elitezone
Post Prodigy
Post Prodigy

Function does not work (label with CountRows)

Hello,

 

I had a function like that:

 

(CountRows(Gallery2.Selected.WhoLikedPeople) = 0,"Brak polubień","Zobacz listę (" & CountRows(Gallery2.Selected.WhoLikedPeople) &")")

 

It worked flawlessly showing either "No results - Brak polubień" and "Check list - X amount - Zobacz listę X)

 

but I need to change it to work conditionally:

 

If(varTop,CountRows(Gallery2.Selected.WhoLikedPeople) = 0,"Brak polubień","Zobacz listę (" & CountRows(Gallery2.Selected.WhoLikedPeople) &")",CountRows(Gallery3.Selected.WhoLikedPeople) = 0,"Brak polubień","Zobacz listę (" & CountRows(Gallery3.Selected.WhoLikedPeople) &")")

 

I want to execute it based on variable varTop (true/false) but I receive errors:

Invalid argument type Text expecting a Boolean.

Function if has invalid argument.

 

Basicly I want to execute this if varTop is true:

 

(CountRows(Gallery2.Selected.WhoLikedPeople) = 0,"Brak polubień","Zobacz listę (" & CountRows(Gallery2.Selected.WhoLikedPeople) &")")

 

and this if it is false:

 

(CountRows(Gallery3.Selected.WhoLikedPeople) = 0,"Brak polubień","Zobacz listę (" & CountRows(Gallery3.Selected.WhoLikedPeople) &")")

 

 

This function is on label.

Please advise what should I do.

 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User III
Super User III

Hi @Elitezone 

I think you just need to nest your if statements like so...

If(varTop,
   If(CountRows(Gallery2.Selected.WhoLikedPeople) = 0,
       "Brak polubień",
       "Zobacz listę (" & CountRows(Gallery2.Selected.WhoLikedPeople) &")"
    ),
   If(CountRows(Gallery3.Selected.WhoLikedPeople) = 0,
       "Brak polubień",
        "Zobacz listę (" & CountRows(Gallery3.Selected.WhoLikedPeople) &")"
   )
)

View solution in original post

1 REPLY 1
timl
Super User III
Super User III

Hi @Elitezone 

I think you just need to nest your if statements like so...

If(varTop,
   If(CountRows(Gallery2.Selected.WhoLikedPeople) = 0,
       "Brak polubień",
       "Zobacz listę (" & CountRows(Gallery2.Selected.WhoLikedPeople) &")"
    ),
   If(CountRows(Gallery3.Selected.WhoLikedPeople) = 0,
       "Brak polubień",
        "Zobacz listę (" & CountRows(Gallery3.Selected.WhoLikedPeople) &")"
   )
)

View solution in original post

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (74,184)