In a table with thousands records, I need to select the latest 7 items order by ASC.
In the table option I found the order by, but extract the first 7 records with ASC or the latest 7 with DESC but with inverse order.
Regards
Emanuele
Hi Bob!
thank you for your reply.
Yes with sql code I know how to do that. But I don't know ho I can replicate that with Read Data or if there are a best way in chronoform6 to obtain this result.
Do you have other suggest?
Thanks
Emanuele
Hi Emanuele,
Please check the Writing conditions section at page 24 of the CFv6 manual - I think that you can write a custom query if needed.
Bob
I think that a cusom query its a good way, but I don't now how to insert in chronoforms6.
Please could you to give me an example?
Thanks!
Bob,
please could you to give me an example how I can create a custom query?
Thanks a lot!
Emanuele
Just do read data, sorted by created date, then use a PHP action together the 7 items you want from the array
Hi healyhatman,since the table contains a lot of thousand of record, maybe the best solution is get the seven records with DESC order by and use the array_reverse functions.
But I do not understand how I can do that.
I've read the manual, but in general I have many difficulties to manage the array data with chronoforms 6, with cf5 is more simple.
Thanks
Then use the paging option and set the record count to 7
Get the value array in PHP with $this->get("read_data4", "")
Ok Thank You!
Work fine with this code into PHP module
$revextra = $this->get("read_data4", "");
return array_reverse($revextra);
Emanuele