cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Geoffroy
Level: Powered On

Create a counter from result of filters

Hello,

 

Firstly sorry for my english made by Google Translator.

 

I'm trying to display a counter showing the number of results from different filters. 

 

 

Text of my counter :

If(
CountIf(
Filter('DR ACL_GESCO_Commandes';Or(StartsWith(AddColumns('DR ACL_GESCO_Commandes'.RA_confirme;"RAconfNom";RA_confirme.DisplayName);RAtext));Or(StartsWith(Num_Commande_Client;ComdClienttext));Or(StartsWith(Client;Clienttext)));
true)>0;"Nbr of results : "& CountIf(Filter('DR ACL_GESCO_Commandes';StartsWith(Client;Clienttext));StartsWith(Client;Clienttext));"No results")

 

 

My problem is that "ComdClienttext" never works without "Clienttext". And that I can not add the displayName field check as "RA_confirm"

 

 

 

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Create a counter from result of filters

Hi @Geoffroy ,

1)Do you mean that the formula only works when "Clienttext" has value?

I think that because the result also use the Clienttext value:

"Nbr of results : "& CountIf(Filter('DR ACL_GESCO_Commandes';StartsWith(Client;Clienttext));StartsWith(Client;Clienttext))

2) StartsWith( Text, StartText )

That's the right grammar of startswith.

While the AddColumns function will result table.

So I recommend you save the result of 

AddColumns('DR ACL_GESCO_Commandes'.RA_confirme;"RAconfNom";RA_confirme.DisplayName)

as a collection.

You could try this:

ClearCollect(test,AddColumns('DR ACL_GESCO_Commandes'.RA_confirme;"RAconfNom";RA_confirme.DisplayName))
If(
    CountIf(
             Filter(test;Or(StartsWith(RAconfNom;RAtext));
                         Or(StartsWith(Num_Commande_Client;ComdClienttext));
                         Or(StartsWith(Client;Clienttext)));
True)>0; "Nbr of results : "& CountIf(Filter('DR ACL_GESCO_Commandes';StartsWith(Client;Clienttext));
StartsWith(Client;Clienttext));
"No results")

Here's a doc for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-startswith

 

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Create a counter from result of filters

Hi @Geoffroy ,

1)Do you mean that the formula only works when "Clienttext" has value?

I think that because the result also use the Clienttext value:

"Nbr of results : "& CountIf(Filter('DR ACL_GESCO_Commandes';StartsWith(Client;Clienttext));StartsWith(Client;Clienttext))

2) StartsWith( Text, StartText )

That's the right grammar of startswith.

While the AddColumns function will result table.

So I recommend you save the result of 

AddColumns('DR ACL_GESCO_Commandes'.RA_confirme;"RAconfNom";RA_confirme.DisplayName)

as a collection.

You could try this:

ClearCollect(test,AddColumns('DR ACL_GESCO_Commandes'.RA_confirme;"RAconfNom";RA_confirme.DisplayName))
If(
    CountIf(
             Filter(test;Or(StartsWith(RAconfNom;RAtext));
                         Or(StartsWith(Num_Commande_Client;ComdClienttext));
                         Or(StartsWith(Client;Clienttext)));
True)>0; "Nbr of results : "& CountIf(Filter('DR ACL_GESCO_Commandes';StartsWith(Client;Clienttext));
StartsWith(Client;Clienttext));
"No results")

Here's a doc for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-startswith

 

 

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

TopShelf-MSFT
Level 10

Re: Create a counter from result of filters

Hi @Geoffroy can you review the above reply and update the thread if it was helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,326)