Hi all, I have an app which is a bit like a User Directory where users create a profile adding information about themselves (name, location, email, role, interests). Iโd like to set up a view where the user can see other users with the same interests. All of the data is captured in a main table โDataโ, however the โinterestsโ are selectable from a list in another table called โInterestsโ. Iโm stuck on how to create this view. Iโve tried creating a slice using โFILTER(โDataโ,([Interests] = [_THISROW].[Interests]))โ but I get the error โThe expression is valid but its result type โListโ is not one of the expected types: Yes/Noโ. Any ideas?
Solved! Go to Solution.
Could you please try an expression something like below in the slice filter
AND(COUNT( INTERSECT( [Interests], SPLIT(SELECT(Data[Interests],[Email] = USEREMAIL()), โ,โ)))>0 , [Email]<> USEREMAIL())
Have not tested it.
Minor edits in expression done.
Please try slice filter expression as
IN([Date Tableโs Key Column], FILTER(โDataโ,([Interests] = [_THISROW].[Interests])))
Hi @Suvrutt_Gurjar, Iโve just tried this but it only returns a โYโ for my record and not for any of the other records even though they have the same interests. Do you know if it searches within a string or is it looking for exact matches?
Is FILTER(โDataโ,([Interests] = [_THISROW].[Interests])) returning multiple key values?
You could test it in a VC in the same table.
It only returns my row, because only my row has a matching key (email address)
Got it. Sorry that I missed your latest update post and hence responding a day later. Just in case you are still looking for a solution, please try creating a slice expression something like below
[Interests]=LOOKUP(USEREMAIL(), โDataโ, โEmail Column Nameโ, โInterestsโ)
Thanks for this suggestion @Suvrutt_Gurjar, however I keep getting the error message;
โCannot compare List with EnumList in ([Interests] = ANY(SELECT(Data[Interests],([Email] = USEREMAIL()))))โ
Any ideas?
What is the column type
EnumList - because it is referencing another table for itโs values. Basically the user creates a profile and selects interests from a list. This list is held in another table hence EnumList.
Also since you are creating user based filters, please thoroughly understand the concepts of security filters and slice filters.
Please refer the section โCan slices be used instead of a security filter?โ in the article below
The EnumList table is also called โInterestsโ.
Thanks. What if a user 1 has interests { A, B, C }, user 2 { D, B, C } user 3 { D, G }
Then what user 1, user 2 and user 3 should see in their respective slices?
I have a view called โDirectoryโ where the user should see all other people with matching interests to theirs. This is where the [Interests] slice would be.
In your example;
user 1 should only see user 2 in their Directory view
user 2 should see users 1 and 3 in their Directory view
user 3 should only see user 2 in their Directory view
Hope thatโs clearer now.
Thanks
Can user 1 see himself also along with user 2
Can user 2 see himself also along with users 1 and 3
Can user 3 see himself also along with user 2
Ideally the user would not see themselves in the Directory view, this view will be used to connect with other members (send email, sms etc)
There is another view called โMy Profileโ where the user can see and update their own details.
Could you please try an expression something like below in the slice filter
AND(COUNT( INTERSECT( [Interests], SPLIT(SELECT(Data[Interests],[Email] = USEREMAIL()), โ,โ)))>0 , [Email]<> USEREMAIL())
Have not tested it.
Minor edits in expression done.
โINTERSECT does not accept a list of list.โ
Do you think it could be getting confused because I have columns with the same name in different tables?
I have my main table called โDataโ with a column called [Interests]
โDataโ references another table 'โInterestsโ (a simple list) that also has a column called [Interests]
Can you share the screenprint of the expression entered in the slice filter formula and the error displayed?
It perfectly works for me.
SPLIT() is used to convert list of lists into a normalized list.
Hope your [Email] column name is [Email] only and [Interests] is an Enumlist column in โDataโ table.
Yes @Suvrutt_Gurjar both of those are correct and yet I still get that error?!??
Please try changing Base type of Enumlist column [Interest] to Text and test
@Suvrutt_Gurjar you bloody legend!!! That seems to have done the trick
Thank you so much for all your help! Iโve been pulling my hair out over this. Now to test it with other usersโฆ
Good to know it works. Please thank senior community guide @Steve as well. He asked to post the screenshot of the column setting where the final issue was hiding.
Can you just explain why that was the issue? So I know for future use. I have another table โLCRNโ which is used in a similar manner although is Type Enum, should I be changing the base type of that column to text as well?
Yes, base type is applicable for Enum also.
The final issue was Enumlist column is list of some type of items. If it is a list of numbers , the base type of column needs to be Number. In your case base type was text, since [Interests] are list of texts. So a list can be of dates, numbers, texts and so on. Accordingly base type of Enumlist column needs to be selected. The earlier incorrect base type setting was โEnumlistโ, so it was creating list of lists and hence the error.
My request will be to go through following articles. AppSheet has rich set of well explained articles with examples. Please search by search words such as โenumโ, โCOUNT()โ, โReferenceโ and you will get a list of relevant articles.
https://www.appsheet.com/Support
The following post has many references useful for an AppSheet app building
Hi @Suvrutt_Gurjar, if I now wanted to sort this list where would I add the SORT expression? Iโve tried adding it at the start and stating True as I want the list in descending order but I just canโt get it to work. It says Sort has invalid inputs.
Thanks @Steve, I have tried this but it doesnโt seem to like it hence my post. Iโm trying to sort the following expression;
AND(
[Hide Profile] = โNoโ,
AND(COUNT(INTERSECT([Professional Interests], SPLIT(SELECT(Data[Professional Interests],[Email] = USEREMAIL()), โ,โ)))>0 , [Email]<> USEREMAIL()))
Basically Iโd like the list sorted by number of matches (high to low). Iโve tried adding in Sort both before and after the second And statement but in both instances I get the message โSort has invalid inputsโ.
Any ideas where Iโm going wrong?
Oh, this is in a view. The order rows are displayed within a view is controlled by the view configuration, not by the slieโs row filter condition.
The issue Iโve got is that the View doesnโt allow me to sort by Expression (unless Iโm missing something?) I can only sort by Columns. Any way around this?
There is no way to sort a view by expression.
Okay thanks. Possible future feature?
Please post a screenshot of the configuration screen of the Interests column, down to and including the entire Type Details section.
Thanks for this suggestion @Steve! @Suvrutt_Gurjar seems to have identified the issue and has provided a solution
My base table called โDataโ
Configuration of the [Interests] column within โDataโ.
User | Count |
---|---|
17 | |
11 | |
11 | |
8 | |
4 |