Re: [web2py] Re: Get rows by id list keeping the order

2018-04-23 Thread Carlos Cesar Caballero Díaz
Thanks Leonel, that sounds interesting, I will take a look. Greetings. El 23/04/18 a las 11:30, Leonel Câmara escribió: I would make a function that automatically generated case statements for the orderby | defmake_orderby(idlist):     result="CASE" fori,el inenumerate(idlist):         resul

[web2py] Re: Get rows by id list keeping the order

2018-04-23 Thread Leonel Câmara
I would make a function that automatically generated case statements for the orderby def make_orderby(idlist): result="CASE" for i, el in enumerate(idlist): result += " WHEN id = %d THEN '%d' " % (el, i) result += " ELSE id END ASC" return result I have not tested th

Re: [web2py] Re: Get rows by id list keeping the order

2018-04-22 Thread Carlos Cesar Caballero Díaz
Thanks Anthony, I will go with the first option and guess how to adapt it to postgress too. Greetings. El 22/04/18 a las 12:12, Anthony escribió: On Sunday, April 22, 2018 at 11:46:13 AM UTC-4, Carlos Cesar Caballero wrote: Hi guys, I have a list of ids, and I need to obtain the records

[web2py] Re: Get rows by id list keeping the order

2018-04-22 Thread Anthony
On Sunday, April 22, 2018 at 11:46:13 AM UTC-4, Carlos Cesar Caballero wrote: > > Hi guys, I have a list of ids, and I need to obtain the records keeping > the list order. In MySQL I can use FIELD() in the "order by" for that. > Can I get the ordered records using the DAL? > The DAL doesn't hav