301
Views
66
Comments
[SortRecordList] Discussion
Question
sortrecordlist
Service icon
Forge asset by SortRecordList Team

Hi all,

This extension doesn't work with Outsystems 5.0 when the recordlist to be ordered has more than one structure, anyone has fixed it?

Thanks,
2020-03-05 15-52-45
André Vieira
Staff
Hi Rodrigo,

We'er using the attached extension without problems. Can you try it out.

Cheers,
André
SortRecordList.xif
2023-10-06 09-22-20
Tiago Bernardo
Champion
Hello all.
Also with me the extension SortRecordList 5.0.2.24 with Outsystems platform 5.0.2.24 is not working. It raises an exception "Failed to compare two elements in the array."
Version 5.0.2.19 doesn-t work either.
With version 5.0.2.6 of the extension it works.
I'm using Service Studio 5.0.2.24.
Attached is a simple espace that replicates the problem.
Teste_SortRecordList_v3.oml
UserImage.jpg
Nelson Sousa

Hi,

I'm having the same problem. I've just migrated the SortRecordList from 4.2 to 5.0 and it doesn't work anymore. Anyone knows why?


Best Regards,
Nelson Sousa

2020-03-05 15-52-45
André Vieira
Staff
Hi Nelson,

The extension can't be migrated directly from 4.2 to 5.0 because the Platform's model has changed. Have you tried the extension I've uploaded in a previous post? Does it work with that one?

Cheers,
André
UserImage.jpg
Nelson Sousa
Hi André,

Yes, I've tried it, and it still sends the same error. Thanks.
It also sends the error attached.


Best Regards,
Nelson Sousa
errorServiceCenter.JPG
2020-03-05 15-52-45
André Vieira
Staff
Hi Nelson,

From your screen shot it seems that you're trying to sort the record list by a column that doesn't exist in it's structure. I'm not 100% sure but if you're sorting using 'ssOrder' as your column try using the attribute's exact name that is probably just 'Order'.

If this fails I suggest you send this information to OutSystems Support. I don't have much information so that I can help you much more.

Hope that this helps you.
Cheers,
André
UserImage.jpg
Nelson Sousa
Hi André,

That's what I'm doing. I'm ordering it by the name "order". Internally the extension adds the "ss" to the string. "ssOrder" is the name that the variable has in the c# code of the extension.

The column exists in the structure. I had the 4.2 platform and it worked just fine. Now I've converted to 5.0 and it stopped working, with no modifications in the code.

I've already send the information to Outsystems support. Thanks.


Best Regards,
Nelson Sousa
UserImage.jpg
Jeff Neuhaus
Any one get this working in 5.1 yet?
UserImage.jpg
Luís Reis
It works for me if the RecordList is of an entity Type, but if it's from a Structure, it doesn't work.
2025-02-22 18-27-01
Alfaro
 
MVP
Hi all,

I've updated this extension to be able to do a multi-column sort, similar to an "order by" clause, by passing it a comma-delimited list of columns to sort by.

Cheers,

Carlos Alfaro
SortRecordList.xif
2024-01-05 16-00-17
Filipe Lourenço
And what about java version?
2014-02-19 10-04-29
Gonçalo Fonseca
Staff
Carlos,

Your version with the multiple columns sort is a really nice improvement, and working like a charm with 6.0.

There was just one thing that took me a little while to figure out, so I want to share it here, which is that you have to prefix the attribute (column) name with the Entity/Structure name.
In hindsight I guess it was easy to see what I was doing wrong, but it stumped me for a while :-)


Thank you.
2018-07-16 13-30-04
Miguel Grilo
Gonçalo Fonseca wrote:
Carlos,

Your version with the multiple columns sort is a really nice improvement, and working like a charm with 6.0.

There was just one thing that took me a little while to figure out, so I want to share it here, which is that you have to prefix the attribute (column) name with the Entity/Structure name.
In hindsight I guess it was easy to see what I was doing wrong, but it stumped me for a while :-)


Thank you.
 
Can you give an example to de input on the order by parameter? 
Thank you
 
2011-11-23 13-56-48
Tommy
Has anyone succesfully used this extension with the List_Navigation widget?
2019-11-12 17-31-26
Justin James
 
MVP
I need to put this in the discussion because I always come here to look it up when I forget...

The format for the multi-column sorting is:

"EntityName.AttributeName,EntityName2.AttributeName2" etc.

No curly braces or square braces...

J.Ja
2016-04-21 20-09-55
J.
 
MVP
Is there a java version of the multisort?
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
I don't think the current version is able to sort on attributes in nested structures, or is it? So not just Entity1.Attr1, Entity2.Attr2, but something like Struct1.Attr1.Struct2.Attr2,Struct1.Attr2.Struct4.Attr5 or the like? Since we needed something like that I wrote it myself, and it works like a charm (as far as I've tested, I haven't tested every possible combination), but maybe I overlooked something.
2020-08-05 08-52-58
Ruben Goncalves
Hi Kilian,

Why not join the team then? :)
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Well, I could, but I've basically rewritten almost everything :) I could like some beta-testers though :) Is there a way to add an attachment to a post?
2025-11-03 12-56-18
Evert van der Zalm
 
MVP

Hi All,

I get an error on my acpt environment when I use the sort record list extension, anybody an idea what could be causing it?

The error I get:

Error: Method not found: 'Void OutSystems.NssSortRecordList.IssSortRecordList.MssSortRecordList(System.Object, System.String, Boolean)'.

Kind regards,
Evert
2016-04-21 20-09-55
J.
 
MVP
Hi,

when will it possible to sort the recordlist ascending/descending per attribute.

for example:

entity1.date desc, entity1.name asc
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
"when will it possible" - when you ammend the extension? :) I've been thinking of allowing that in my version of the extension, but it isn't completely trivial, unfortunately.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Ok, I exaggerated, it was 10 min. work. My version now accepts " asc" or " desc" after the field name to override the default sorting specified when calling sortrecordlist. I've got to rename some variables now for optimal legibility, but I'm confident I can finish that this week, and I'll upload my version as attachment to a post.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Ok, here's my version that can both sort on multiple fields, at any depth in the records, and can also sort ascending and descending. Though it is tested, I can't vow for it to be bug-free, so consider it a beta version if not a release candidate :).

EDIT: Three disclaimers:
1) I'm not a .NET programmer. Though well-versed in C and to a lesser extent C++, my .NET knowledge is wanting. So if I violated any .NET standards or common practices, apologies and please tell it here so I can change it.
2) I haven't coded it for performance, so performance may well be worse than the original version.
3) I've never done anything Java, so no Java version from me, sorry!
EDIT: and a fourth one:
4) We've tested it with structures, but not so much with entity records, so I'm not entirely sure it'll work for those (though it should!)
SortRecordList.cs
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
It seems I can attach only one file at a time, so here's the most important part.
RecordListComparer.cs
2011-06-15 10-51-58
Ana Santana
Hello!

I have a structure with an attribute that's an Integer.
Then I use this structure to construct a List, that is used in a Table Records widget.
Then I apply a List_Navigation widget to the table, and finally I apply this sort extension and try to order from that Integer attribute.
It looks like it works in the first page.
When I start navigating through the table's pages, it's all  unsorted. I don't even see a pattern that would help understand what's happening.

Has anybody used this extension like this before, and had it working?
I would love to hear some ideas...

Thank you

Regards,
Ana

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Hi Ana,

In order for this to work correctly, you must first apply the sorting, before the list is used by the Table Records. If you don't, the behaviour depends a few factors, but the outcome will never be what you want (as you experienced).
2011-06-15 10-51-58
Ana Santana
Hello Kilian

And how should I do that?
The sorting is by user request, when they click on the given column...
I forgot to say I am using the List_SortColumn widget for the sorting, and a custom made action to call the SortRecordList action... And using version 8.

Thanks
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Hi Ana,

You should sort the list, then explicitly assign the list to the TableRecords. I've included a simple eSpace to show how it works (note that normally, you'd not use a separate list when the data comes directly from the database, this is just for showing the principle).
TestListAssignment.oml
2011-06-15 10-51-58
Ana Santana
Hello Killian,

Many thanks! I figured what I was doing wrong with your example.

Best regards,
Ana
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Glad I could be of help, could luck with your project.
UserImage.jpg
Kenneth Jolly
Hi all,

We've just started using Outsystems and I have build a list screen using this extension to sort of web service results. I was hoping someone could help in clarifying a sort order issue I'm finding.

When I sort alphas the case of the character is affecting the results eg if we had 3 names of fred, andrew and Keith, then using this extension we either get fred,andrew,Keith or Keith,andrew,fred.

The capital "K" is being sorted as less than "a". Ideally I want the search to be case independant eg andrew,fred,Keith or Keith,fred,andrew. Is this possible ?

Hope this makes sense.

Any help appreciated. Thanks.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Sorting is alphabetically, and capitals sort before lower case. The sorting is not case-independant.
UserImage.jpg
Kenneth Jolly
Killian,

thanks for the quick reply.

I don't think it is sorting alphabetically. it is sorting lowercase first and then upper case.

I downloaded the front end of this extension with the computers entity. I added an entry with a network name of "california". When sorting on network name this appeared first with the original "California" at the bottom. This means lower case are sorted first, followed by upper. I would have expected "california" to be below "California".

Is this the way it is supposed to work ?
2019-11-12 17-31-26
Justin James
 
MVP
Maybe this component needs a case-insensitive sort option to be added?

J.Ja
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
@Kenneth, are you using the Java version or the .NET version?

@J.Ja: my thoughts as well
UserImage.jpg
Kenneth Jolly
Sorry,

forgot to say I'm using the Java version. I'm using outsystems 8.0.1.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Ok, I can't say anything about Java, I only know the .NET version. It seems strange though, the results you are getting.
UserImage.jpg
Kenneth Jolly
Thanks for the replies - I have created a workaround which is not idel but does resolve my issue.

I've created a field on my list which is never displayed. When I sort on a particular field eg name, I move that name to this field and convert to uppercase. I then sort on this field rather than the name.

I've done it this way as I have many fields in my list that I want to sort - if there are just a few, I suppose I could have created duplicated columns and assigned these when I get my data back. This would avoid any overheads when clicking on column to sort.

Thanks for you help.
UserImage.jpg
Ali Ahsan
I have four entities in the result list which I want to sort by Table1.Field1,Table2.Field2 and it is not working. I am using platform 9 in .NET environment.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Ali, I don't think the original extension is able to do that. I created a new version that can do that, which I've attached somewhere above. To make it work with version 9, you should change recordList.Data.Sort to recordList.Sort in SortRecordList.cs.
UserImage.jpg
Ali Ahsan
Thanks Kilian,

I thought the version attached to this page was yours. Thanks for correction. And I appreciate your quick response.

Take good care of yourself :)
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Hi Ali,

You're welcome. Let us know whether it works.
UserImage.jpg
Nuno Mendes
Hi,

We are trying to use this extension with Structures in version 9.0 (getting the last stable download of this component) and we are getting the following error previously reported:  "Failed to compare two elements in the array."

Did anyone got the same error?

Thanks.

Best Regards,
Nuno Mendes
2019-11-12 17-31-26
Justin James
 
MVP
That usually means that you are passing in the wrong entity/structure or attribute names to be sorted. It may also mean bad data, not 100% sure on that.

J.Ja
UserImage.jpg
Nuno Mendes
Hi Justin,

We are trying the same exact test with a Entity and it works fine, just a entity with 2 attributes Id (integer) and Desc (text). A structure with Id (integer) and Desc (text) and it gives us the error described.

Thanks.

Best Regards,
NM
2019-11-12 17-31-26
Justin James
 
MVP
Nuno -

Can you send an eSpace with the problem code?

J.Ja
UserImage.jpg
Nuno Mendes
Hello Justin,

You can access the test right on my personal environment acessing the URL: https://mendes.outsystemscloud.com/SortTest/Sort.aspx

I attach the eSpace too.

Thanks for the help.


Best Reggards,
NM
SortTest_ChangedToReproduceError.oml
2019-11-12 17-31-26
Justin James
 
MVP
Nuno -

Your "sortBy" parameter is wrong, as expected.

It needs to be in the form of:

EntityName.AttributeName

For example:

User.Name

or

Employee.EmailAddress

The "Nr" is going to fail.

J.Ja
2023-08-19 05-23-29
Joshua Austin
Hello,

How do I sort by a column that is in a record within a structure?  Example eSpace of what I'm trying to do is attached.

Thanks,
Josh
SortNestedTypes.oml
2024-01-22 15-21-29
Pedro Cardoso
Joshua Austin wrote:
Hello,

How do I sort by a column that is in a record within a structure?  Example eSpace of what I'm trying to do is attached.

Thanks,
Josh
 Josh!

How's it going?! Nice to see you around and trying stuff :)

To sort by the event name, do the following:



Cheers,
Pedro Cardoso



 
2014-02-19 10-04-29
Gonçalo Fonseca
Staff
Hello Josh,

I don't believe there is a direct way to do this with SortRecordList.

What you can do is add an extra attribute to the structure, based on the content of the record, and do the sorting on this new attribute.

Example:

Record
  • First Name
  • Last Name
  • ...
Structure
  • Record
  • SortAttribute = FirstName + " " + LastName

I wasn't able to download your sample eSpace, so I'm not sure this approach is suitable for you.

Cheers,
Gonçalo
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Hi Joshua,

If the advise above doesn't work out for your usecase, you can always pick up my version, which can sort fields in nested structures to indefinite depth. I've attached the latest one to this post. (I also think my code is a lot cleaner than the original one, but hey, judge for yourself :))
SortRecordList.xif
2023-08-19 05-23-29
Joshua Austin
Using Pedro's "x.y" instead of "{x}.[y]", with Kilian's latest SortRecordList version, combined with converting my data source from a list to a record list did the trick.  Thanks, guys!!!

Good to see you too, Pedro!  I'm doing great!  Planning to take the exam for Professional OS certification soon.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Glad I could be of help.
2018-05-10 21-32-45
Fernando Branco
Hello there.

I'm using service studio version 9.0.1.5 and I'm getting the same error as @Mendes.

I have created a structure "SkillsPercentage" with two atributes "Name" and "Value" as you can see in attachment. Then I created 2 local variables, "SumOfSkillsPercentages" that is a list "SkillsPercentage List" and "SkillPercentageSum" (type "SkillsPercentage"). "SumOfSkillsPercentages" is created by appending n "SkillsPercentageSum".

Now I want to sort by "Value" the SumOfSkillsPercentages" but I'm getting the error and seems it's all well. Do you have any idea what is wrong? 

Thank you for your time, I really appreciate. 
Sem título.png
2023-10-06 09-22-20
Tiago Bernardo
Champion
Hello.
The "sortBy" parameter should be the _name_ of the attribute you want to sort by, so you should use the string "Value".
2018-05-10 21-32-45
Fernando Branco
Hi there again and thank you.

I tried it already and I have the same error.
2023-10-06 09-22-20
Tiago Bernardo
Champion
I've downloaded the espace that Mendes provided above.
SortRecordList does not seem to work with variables of type "List". You _must_ use a variable of type "Record List".
In the espace provided by Mendes, the sort of the entity works because the variable used is the result of an aggregate. The sorting by structure does not work because a "List" variable (to which the elements are appended) is being used.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Tiago Bernardo wrote:
SortRecordList does not seem to work with variables of type "List".
Variables of this type are completely different internally, and difficult to handle in an extension (not to mention completely undocumented). So yeah, they don't work.
2018-05-10 21-32-45
Fernando Branco
Alright. So any tip to solve this?

Thank you.
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Ferenando,

What do you mean exactly? Do you also use a List of type instead of a Record List? In that case, change your input to a Record List.
2023-10-06 09-22-20
Tiago Bernardo
Champion
Tip: Your variable "SumOfSkillsPercentages" instead of being of type "SkillsPercentage List" must be of type "SkillsPercentage Record List".
2018-05-10 21-32-45
Fernando Branco
Well, my bad. Didn't see the "record".

Worked now :)

Thank you Tiago and Kilian.
2020-03-05 15-52-45
André Vieira
Staff
Hi Fernando and Tiago,

The latest version now supports the List data type, kudos to Hugo Lourenço for that overhaul!!
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
That's very cool, I'll give it a look and see if I can integrate that in my version.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.