cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,011)