Iterating a comparison and look up over a list for Forum Mentions

Not quite sure of the syntax or paradigm of doing this:

I have a forum table which allows several mention identifiers based on user data, eg, @Tom, @TomSmith, @Smith, @TomsGamerHandle, etc. (Yes, Smith is not a great identifier, but for the sake of argument…). What I have tried to do is the following:

-Extract Mentions from the forum post into a v col list in the Forum Table.
-Created a v col in the User table that is a list of all possible mention identifiers for a particular user (For Tom, it would be all of the above plus “channel”, Tom’s email, etc)

To allow a user to see their mentions on their “home” page, I think what I need to do is create a v col of type list that is the intersection of Tom’s mention identifiers with the mention list column from the forum table in which his identifiers appear. OR, the Forum table needs a v col which extracts mentions from a post and then creates a list of email addresses (the User table key) relating to those mentions which could just be compared to one’s own email address, and creates a list which could be displayed with an INLINE view. But I am not sure how to go about this. And maybe there’s a simpler way–just not seeing it.

Any help appreciated. Thanks!

Hi! A few questions:

Are the mention identifiers automatically created or inserted by the users?

How do you associate any specific mention identifier with a particular user? For example, what if there are 3 users with the name of Tom?


A suggestion I can make right now is to save the mention identifiers into a separate column at posting time. Don’t allow users to enter the @ tags in their post at all. This gives you two benefits.

  • You don’t have any way to verify that the @ tag is valid, (unless of course you can figure out how to extract the @tags but then you wouldn’t be asking this question), so you can prevent “junk” tags from being inserted into the post.
  • You can provide a multi-select list of previously used tags to assign to the post. This makes it easier for the users to find and continue using known tags.

If the suggestion above does not fit with your needs just say so and the community can help you find a way to solve your issue.

2 Likes

You’ll need to make use of SELECT() to accomplish this, something like this:

SELECT(Mentions[MentionID], IN([_ThisRow].[User_Tag], [Tagged_Users]))


Another option might be to create a Current_User slice, then create an additional slice that uses the formula from above (but pulls the Current_User[UserID] instead; then you could create a view for that subset and show it on the nav bar or in the main menu.

3 Likes

Thank you both for the suggestions–those are both great and useful in different ways. I think ultimately what I would like to do is allow for inline mentions in a post (which can be extracted with EXTRACTMENTIONS()) but allow for a few different forms for them to take. For example, the user Tom Smith whose nickname is Smitty (assume nickname is a column in the user table so known to the app) could be mentioned either with @TomSmith or @smitty. I think I need to create a “Related Mentions” v col in the forum table that takes the list of mentions from the post, and returns a list of unique emails for all that appear. (junk mentions would be ignored because they wouldn’t return a real user). For example:

Forum[Post] =
“Hey @Smitty and @JoeBrown, can you get me those TPS reports ASAP?”

Forum[Related Mentionees] =
{ tom@email.com, jbrown@anotheremail.com }

And then create some sort of relationship or look up field in the User table that associates with those entries based on distilling the mentions down to a unique identifier for each user, in this case email, which is the key in the user table.

And there could be a v col that checks the validity of mentions on posting, perhaps returning the [_ComputedName] of valid mentions as a safeguard against trying to use @Smittttty, which isn’t associated with a user.

It’s as much about usability as thinking through the process of creating this relationship in an elegant way, which will be useful for some other features of this app.

Thanks!

1 Like