All questions about EDocman extension

Sort EDOCMAN_DESCRIPTION does not show the expected sequence

  • Reto Rappa
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 1 day ago - 1 week 1 day ago #171075 by Reto Rappa
Hi, in category display I need a sort option for the description entries, so I changed the view\category\hmtl.php to:
Code:
$options               = ; $options             = JHTML::_('select.option', '', Text::_('EDOCMAN_SORT_BY')); $options             = JHTML::_('select.option', 'tbl.title', Text::_('EDOCMAN_TITLE')); $options             = JHTML::_('select.option', 'tbl.description', Text::_('EDOCMAN_DESCRIPTION')); // new entry $options             = JHTML::_('select.option', 'tbl.created_time', Text::_('EDOCMAN_DATE')); // $options             = JHTML::_('select.option', 'tbl.ordering', Text::_('EDOCMAN_ORDERING')); // entry not needed $lists['filter_order'] = JHTML::_('select.genericlist', $options, 'filter_order', ' class="input-medium form-select" onchange="submit();" ', 'value', 'text', $state->filter_order);

Overall the sorting works, but the results for the descriptions do not show the expected sequence. There are only eight-digit numbers in the description fields, sometimes several separated with spaces. As an example for an ascending sorting please see attached picture.

Do I have to adjust anything else or what could be the reason? Thank you.

Edocman 1.25.6, Joomla 5.12.


 
Attachments:
Last edit: 1 week 1 day ago by Reto Rappa.

Please Log in or Create an account to join the conversation.

More
1 week 1 day ago #171084 by Mr. Dam
Hi Reto,
Actually, your modification doesn't relate the description showing. Could you please tell me more about the description showing issue so i can judge the cause of problem.
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Reto Rappa
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 22 hours ago #171088 by Reto Rappa
Hi Dam,
I use the description field as a part number for product documents. This part number is an 8-digit number, sometimes a product has several part numbers separated by spaces. The problem is that the sorting (ascending or descending) is not correct. As in the picture with ascending sorting I get a list of the documents in the order

01016581
01016696
01016699
01005149
01007277
01008874
01009670
01009738
01011424

but it should be

01005149
01007277
01008874
01009670
01009738
01011424
01016581
01016696
01016699

Sorting for date or title works without problems.

Please Log in or Create an account to join the conversation.

More
1 week 6 hours ago #171099 by Mr. Dam
Hi Reto,
First, the description is text (string value).
When numbers are stored as strings, they are treated as sequences of characters rather than numerical values. In string sorting, the comparison is done based on the lexicographical (alphabetical) order of the characters. This means it looks at the first character, then the second, and so on, rather than evaluating the numeric value of the whole string.
For example:
- The string "10" comes before "2" in lexicographical order because '1' is less than '2' when compared character by character.
- However, if these strings were converted to integers, 10 would naturally come after 2 because we're sorting based on their numeric values.
That's the reason you don't have expected sorting in search result with Description field.
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Reto Rappa
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 days 21 hours ago #171105 by Reto Rappa
Okay, thanks Dam for your explanation.

Please Log in or Create an account to join the conversation.

More
5 days 4 hours ago #171126 by Mr. Dam
You're welcome.
Dam

Please Log in or Create an account to join the conversation.

Moderators: Mr. Dam