cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Automate2create
Helper II
Helper II

Filter syntax issue

I have a filter which starts:

Sort(Filter(
          colCA, If (vCompanyUser <>("Smiths"), CompanyUser, false),
If( ---------a ton of code that basically sets out what should be displayed when a toggle is off or on)

 

What I am trying to achieve is, if our company, “Smiths”, are using the App, we see all the rows in the collection, if any other Company logs in, they only see the rows applicable to that company.   I am pretty sure the <> is wrong but then  !  is only for boolean values.  Maybe my syntax is just plain wrong. 

 

 

3 ACCEPTED SOLUTIONS

Accepted Solutions

@Automate2create So your formular will look something like that:

If(vCompanyUser = "Smiths",colCA,Filter(colCA,CompanyUser = vCompanyUser))

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

If(

vCompanyUser <>"Smiths",

Sort(Filter(colCA,CompanyUser = vCompanyUser),'Input_Date_Time', Descending),

Sort(colCA,'Input_Date_Time', Descending)

)

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

Buy me a coffee!

Check my User Group (pt-PT)!

Last Post on Community

My website!

View solution in original post

Automate2create
Helper II
Helper II

Thanks, I see, I've been able to learn from both yours and @PowerRanger's responses.  Thank you very much!

View solution in original post

11 REPLIES 11
PowerRanger
Resident Rockstar
Resident Rockstar

@Automate2create 

 

1.) Could you tell me the field name in ColCA which should be used for filtering.

2.) How do you determine to which company a user belongs to?

 

 

 




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.
Nogueira1306
Super User
Super User

What is vCompanyUser??

 

If it is a lookup you must use something like: 

vCompanyUser .Name

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

Buy me a coffee!

Check my User Group (pt-PT)!

Last Post on Community

My website!

Hi PowerRanger

 

The field name in ColCA which should be used for filtering is CompanyUser.

 

The way I am thinking of the formula is if( variable vCompanyUser does not equal "Smiths", then filter on CompanyUser from colCA otherwise you are logged in as Smiths so bring back all rows in the datatable using the Collection)

vCompanyUser is a variable that stores the name of the Company who is logged in to the app.

@Automate2create So your formular will look something like that:

If(vCompanyUser = "Smiths",colCA,Filter(colCA,CompanyUser = vCompanyUser))

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

If(

vCompanyUser <>"Smiths",

Filter(colCA,CompanyUser = vCompanyUser),

colCA

)

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

Buy me a coffee!

Check my User Group (pt-PT)!

Last Post on Community

My website!

This is great, the other question is how would I be able to to filter ColCA on 'Input_Date_Time', Descending.

 

I have tried but haven't got it yet

If(vCompanyUser = "Smiths",colCA('Input_Date_Time', Descending), Filter(colCA ('Input_Date_Time', Descending), CompanyUser = vCompanyUser)

 

 

If(

vCompanyUser <>"Smiths",

Sort(Filter(colCA,CompanyUser = vCompanyUser),'Input_Date_Time', Descending),

Sort(colCA,'Input_Date_Time', Descending)

)

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my LinkedIn!

Buy me a coffee!

Check my User Group (pt-PT)!

Last Post on Community

My website!

Automate2create
Helper II
Helper II

Thanks, I see, I've been able to learn from both yours and @PowerRanger's responses.  Thank you very much!

Helpful resources

Announcements
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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,159)