Change "order by" of lookup table on language changing

Hi,I am using PHPMaker 11.0.5.

I have a question about lookup table and sorting field. When I change the the site language I need to change the ordering field. For example in Greek I need to order by “name_gr” while in English I need to order by “name_en”. Is there something to handle this?Thanks!

  1. Do not set the ordering field for Lookup Table.
  2. Use Lookup_Selecting server event (see Server Events and Client Scripts in help file) to add your ORDER BY clause, you can get the current language setting by $GLOBALS[“gsLanguage”]. Since there is no ordering field, the SQL for lookup does not have ORDER BY clause, so you can add your ORDER BY clause after the filter (the WHERE clause).

Works perfect! Thank you.

Can you give an example ?

my case, here is the lookup field :

ID | fonction | functie

When I switch to language FR I need to “order by fonction ASC” but when I switch to NL I need to “order by functie ASC”…

Thanks