Magic Data Select attribute

Permalink Browser Info Environment
I need to be able to assign specific user(s) to a page so I can then do a page-list associated with the individual users. There may be more than one user associated with a page.
I am trying to use a MD select attribute (page attribute) to get a list of users in a certain group, but am getting the following error: "No options available in this context".

My MD expression to list items to be selected is"Agents AS_GROUP LIST_USERS 100 APPLY_EACH USER_NAME END_APPLY_EACH HTML_UL" which tests out fine in the attribute setup screen and gives me the correct list of users, but fails when I try to use it on the page properties -> custom attributes screen and gives me the above error.

I do not have an expression for the labels. Not sure if I need one or what to put there?

Or, maybe there is another way to accomplish this!

Thanks in advance for your help.
~Mike

Type: Discussion
Status: Archived
SiteQwester
View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
An MD select is like an Uber List. The list expression should just list. The item expression names items in the list.
Behind the scenes the select attribute code decides how that should be displayed.

Behind the scenes you probably want to select user IDs

List expression ( a list of user IDS)
Agents AS_GROUP LIST_USERS 100


Each item (translate a user ID into a name)
USER_NAME


============================
Or for selecting user ID by email
List expression ( a list of user IDS)
Agents AS_GROUP LIST_USERS 100


Each item (translate a user ID into a name)
EMAIL


============================
Or for selecting an email by User Name
List expression ( a list of user email addresses)
Agents AS_GROUP LIST_USERS 100 APPLY_EACH EMAIL END_APPLY_EACH


Each item (translate an email into a name)
USER_​WITH_​EMAIL USER_NAME
SiteQwester replied on at Permalink Reply
SiteQwester
Ahhh. OK, got it, but now I can't get my UberList to find the pages. MD expression = (SET 219 AS_PAGE LIST_ALL_PAGES_WITH_FILTER "listing_agent_md" "sharon.drake" 20 SORT_BY TIME_PUBLIC END_SORT_BY REVERSE) finds no pages, but there are 2.
JohntheFish replied on at Permalink Reply
JohntheFish
Have you added the attribute to the page search index and rebuilt the search index?
JohntheFish replied on at Permalink Reply
JohntheFish
Which version of the above did you use? If the first, then the attribute value will be a user id, so you will need to do make the list parameter
( SET 'sharon.drake' AS_USER )
SiteQwester replied on at Permalink Reply
SiteQwester
Yes, I re0indexed the search pages, and the attribute is included.
I used the 1st version above, but I'm not sure where to include the ( SET sharon.drake AS_USER ) code.
JohntheFish replied on at Permalink Reply
JohntheFish
As the value you are matching for the attribute in the list, so
SET 219 AS_PAGE 
LIST_ALL_PAGES_WITH_FILTER "listing_agent_md" ( SET 'sharon.drake' AS_USER ) 20 
SORT_BY TIME_PUBLIC END_SORT_BY REVERSE
SiteQwester replied on at Permalink Reply
SiteQwester
Nope. I had tried similar, but used quotes instead of parenthesis. I also had tried "12" which is the user ID for sharon.drake. Where can I find the actual attribute to verify it's existence? The MD select attribute is displaying the user list that I want, but it doesn't seem to be remembering my selection.
~Mike
JohntheFish replied on at Permalink Reply
JohntheFish
If you do the dashboard sitemap/page search, you should be able to use the column selection to add it as a column to the list.

Or, in phpMyAdmin, look at the table CollectionSearchIndexAttributes and it will appear as a column.

You could also try substituting LIST_​ALL_​PAGES_​WITH_​FILTER_​CONTAINING. Sometimes attributes (particularly multi-select attributes) are padded with \n as a separating character.

You could also try making the user name the value of the attribute, so for the attribute list
'Agents' AS_GROUP LIST_USERS 100 APPLY_EACH USER_NAME END_APPLY_EACH

Attribute value
AS_USER USER_NAME

And for the listing
SET 219 AS_PAGE 
LIST_ALL_PAGES_WITH_FILTER_CONTAINING "listing_agent_md" 'sharon.drake' 20 
SORT_BY TIME_PUBLIC END_SORT_BY REVERSE


I am away from tomorrow to 23, so will probably only have sporadic email contact and won't have access to my dev system.
SiteQwester replied on at Permalink Reply
SiteQwester
I'm not sure which or both, probably the combination, that worked, but it worked! Thank you so much!!!

With C5, your add-ons, and supurb service, DIY's like me can achieve custom web applications. Simply amazing!

Thanks Again!
JohntheFish replied on at Permalink Reply
JohntheFish
That would make a great comment for a review when you have a few minutes to spare.
I will mark this thread as resolved.

concrete5 Environment Information

.

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.