Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

Sorting Template View by Custom Attributes
Last Post 03/27/2012 2:30 PM by Peter Donker. 8 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Jason Scott
New Member
New Member
Posts:46


--

My problem comes when I try to enter a SORTABLE HEADING for this.  I see these headings are defined in the Page Template.  For instance, I see that the sortable column heading for the "Last Modified" column begins as follows:

04/12/2010 10:09 PM

I feel like I'm VERY close to having this figured out, but can't get this last peice of the puzzle figured out.  In using DMX 5.2.2 on a DNN 4.8.4 install.

I'm using Template View trying to add colums for Custom Attributes that we have defined.  I've looked in the database and found that the ID for my desired attribute is "att124".  I can correctly get the actual data to display in the Item Template when I add the following line:

[entryattribute:att124]
     [resources:LastModified.Text]
    

I understand the "&sort=" is the portion I'm supposed to be concerned with.  However, if I enter "&sort=att124", I'll get an error when I try to sort by that column, as if it doesn't know what att124 is.  I've also tried "&sort=[entryattribute:att124]", and while clicking the column heading doesn't throw an error, it doesn't sort the items either. 

Can anyone tell me what the correct syntax for the "&sort=" section should be?  In addition, what would I use on the next line, which starts [query:sort=lastmodified|inline;none]? 

Thanks in advance!

Jason

Jason Scott
New Member
New Member
Posts:46


--
04/15/2010 5:20 PM

Man, I just now saw what a jumbled mess my post became. I can make my question much simpler.  In the Template View UI, when I am creating my sortable column headings for CUSTOM attributes, what is the correct syntax to use?  For instance, it seems to know what "sort=lastmodified" means.  However, it does NOT know what "sort=att124" means (where att124 is the key of my custom attribute). 

Any thoughts?

Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
04/16/2010 10:39 AM
Hi Jason,

Your reasoning is correct. I'll have to investigate to see what's wrong. But you're correct in using att123 as key for sorting.

Peter
Kevin
New Member
New Member
Posts:4


--
03/21/2012 5:58 AM
Did this get sorted out? I'm having the same issue.
Kevin
New Member
New Member
Posts:4


--
03/21/2012 6:14 AM
Sorry it might be helpful if I give my versions
dnn 5.6.2
dmx 6.0.2
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
03/21/2012 9:08 AM
Hi Kevin,

What issue are you now having? The issue Jason had was resolved in DMX 5.2.7.

Peter
Kevin
New Member
New Member
Posts:4


--
03/21/2012 7:34 PM
I'm modifying the View Template to display custom attributes, which it does beautifully by using att5 but when I add it to the sort I get the following error:


Error: Object reference not set to an instance of an object.

In: at Bring2mind.DNN.Modules.DMX.Entities.Entries.EntriesController.GetCollectionContents(Int32 PortalId, Int32 CollectionId, Int32 UserId, Boolean UserIsAdmin, String Locale, Boolean IncludePermissions, Boolean IncludeAttributes, Boolean IncludeDeleted, Boolean IncludeHidden, String Sort, Int32& TotalCount, Int32 StartRecord, Int32 EndRecord) at Bring2mind.DNN.Modules.DMX.TemplateView.ᜀ(String A_0, Dictionary`2 A_1, List`1& A_2, List`1& A_3) at Bring2mind.DNN.Modules.DMX.Services.Templating.ViewTemplate.ᜀ(String A_0, Dictionary`2 A_1, List`1& A_2, List`1& A_3) at Bring2mind.DNN.Modules.DMX.Services.Templating.Template.ᜀ(String A_0, Dictionary`2 A_1, List`1& A_2, List`1& A_3) at Bring2mind.DNN.Modules.DMX.Services.Templating.Template.ᜀ(Match A_0) at System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator) at Bring2mind.DNN.Modules.DMX.Services.Templating.Template.ReplaceContents()




Code:
Discipline
Resulting url: http://www.privateinfo.co...=1&sort=att5&so=desc


This one does not give an error, but it also does not sort:
Discipline
Resulting url: http://www.privateinfo.co...ryid=1&sort=&so=desc
Kevin
New Member
New Member
Posts:4


--
03/21/2012 7:37 PM
Sorry the codes are:
a href="[dmxmodule:url]entryid=[entry:entryid]&sort=att5&so=[query:!so|desc;][query:so=asc|desc;][query:so=desc|asc;]" Class="CommandButton">Discipline
and

a href="[dmxmodule:url]entryid=[entry:entryid]&sort=[entryattribute:att5]&so=[query:!so|desc;][query:so=asc|desc;][query:so=desc|asc;]" Class="CommandButton">Discipline
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
03/27/2012 2:30 PM
Indeed there is a bug there. Here is a quick workaround. Run this under Host > SQL:

UPDATE {databaseOwner}{objectQualifier}DMX_Attributes
SET [Key]='att'+CAST(AttributeId AS NVARCHAR),
ShowInUI=1
WHERE [Key] IS NULL
GO

You are not authorized to post a reply.