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

@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 Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,966)