Hi There,

RichWidgets\List_SortColumn in Table records functionality is not working, getting Invalid syntax error

(See attachment).

Please see the attached design of tables (excel sheet attachment).

When end user table is saved, it saves the ID from control table instead of text value.

But when I sorting them in Table records,  i am getting invalid syntax error.

Can anyone help me on how to sort attribute (calculated) in Table records?

Thanks

Hello Phani M,

Did you change recently any entity name or attribute? Please check it and confirm if the values that you are passing at RichWidgets\List_SortColumn are correct.


BR,

Luis

Hello Phani.

Can you share the oml or the error from service center?

The format for dynamic sorting is "{Entity}.[Attribute]" for normal attributes. For calculated fields, it is simply the field name.

https://www.outsystems.com/forums/discussion/19105/sorting-on-an-aggregate-with-a-group-by/

Here I calculated time since last login and ordered by days.

No.

I am using entities two times in join condition to get desired result.

X

Y  X.con =Y.con1

X

Y  X.con =Y.con2

when i give value in sort in two columns it saying sory columns in used more than once.

It is hard to understand your data model.

Is the query like this?


How this goes:

1) Is the calculated field working? Can you see results without the Order By?

2) Is Dynamic Sorting working? Can you dynamically sort by an attribute?

3) Is the Dynamic Sorting by your calculated value working?


I could use the same column twice in the sorting, so that is not an issue.



Hi Phani,

Your post title is misleading, your problem is not a calculated attribute, that is something completely different.  

Your problem is that you are joining with the same table twice in one and the same aggregate.  So typically, when only one of each table is in an aggregate, the source name will be the same as the table name (although you can change that if you like).  When you add multiple sources for same table in an aggregate, they will have to be distinguished, so you will need to give at least one of them a different name.

The bit between the curly braces on the richwidgets listsortcolumn should be the source name in the aggregate, not the table name. (in sql terms, you can compare this to the alias name of a table in a query)


See as example attached oml, my test entity has 2 relationships with user table.

So, the sources section of the aggregate looks like this, notice 2 different source names (yellow) each representing a different record in the same table (red underline)

And the listsortcolumn widgets should refer the source name, not the table name


I have done the same in reactive for comparison, where this is much more developerfriendly, the header cell has a dropdown where you pick the right version of the user name.




One more note, after scaffolding and trying to make this demo oml, I ran into some problems where he still held on somewhere to the table name rather than the new source names, probably something with residual cache or session information, so i needed to first remove sorting entirely on the columns, implement, and then re add it with the proper source names.  Just so you don't get discouraged if things don't work right away ;-)


Hope this clarifies,

Dorine


PS, there's 2 modules, you'll need to install both, there's a dependency, sorry for that

Yes.. I am giving two different names in join and in sort column.

in these 2 columns, if i keep sorting option for 1 column it is working, if i place sorting option for other column i am getting error (invalid syntax in order by error)


Thanks

Share your sorting strings. It can be a simple character out of place.

I gave two names. (Sorry I can't share/ give OML screenshots due to company restrictions)

"{Control_Table}.[value]"

"{Control_Table_Second}.[value]"


Join condition:

UserTable

UserTable_Second

Control_Table

Control_Table_Second


Join 1: 

UserTable to Control_Table

UserTable.Error = Control_Table.ID

Join 2:

UserTable_Second to Control_Table_Second

UserTable_Second.TaskType = Control_Table_Second.ID


Join 3

UserTable to to UserTable_Second

UserTable.ReviewID = UserTable_Second.ReviewID



Sorting:


Ok,

this is probably not related to the sorting problem, but there is no need to have UserTable in your aggregate twice, once will do with following joins



Join 1: 

UserTable to Control_Table

UserTable.Error = Control_Table.ID

Join 2:

UserTable to Control_Table_Second

UserTable.TaskType = Control_Table_Second.ID


Can you add screenprints of the richwidgets listsort properties and of the source section and the dynamic sort section of your aggregate.  Just block out the sensitive stuff.

One thing I don't understand

UserTable to UserTable_Second

UserTable.ReviewID = UserTable_Second.ReviewID

If ReviewId is a unique key, both tables will match. You don't need two copies of that one.

Well, I implemented your example and it worked:


Thank you Nuno, Dorine / All

I removed dynamic sort of Review ID column in aggregate and it is working now.