Hi there gurus,
I am a newbie at this:
I created a form which is used by the user to enter Data (both of text and of Date Type) into the Database using Chrono Forms.
I have been able to extract and display this data in table format and with the help of ChronoConnectivity. The tables display the Date of Entry; and A description.
I would like to display these tables ordered by date (i.e. the most recent table ()entry) should be listed first; and the older tables listed after.
Is this possible with ChronoConnectivity? And if so, how?
Thanks
Mukwano
I am a newbie at this:
I created a form which is used by the user to enter Data (both of text and of Date Type) into the Database using Chrono Forms.
I have been able to extract and display this data in table format and with the help of ChronoConnectivity. The tables display the Date of Entry; and A description.
I would like to display these tables ordered by date (i.e. the most recent table ()entry) should be listed first; and the older tables listed after.
Is this possible with ChronoConnectivity? And if so, how?
Thanks
Mukwano
Hi Mukwano,
I'm not sure, you could try adding ORDER BY `field_name` in the WHERE box (after any where code).
Bob
I'm not sure, you could try adding ORDER BY `field_name` in the WHERE box (after any where code).
Bob
Hi,
I was wondering if aside from the ORDER BY statement, if there is a way for a user to sort the table displayed by Chrono Connectivity by his/her preference in the front end?
Thanks!
I was wondering if aside from the ORDER BY statement, if there is a way for a user to sort the table displayed by Chrono Connectivity by his/her preference in the front end?
Thanks!
Hi tidusx18,
I don't think so - maybe in a future version. Though possibly you could code in sorting column headers . . .
Bob
I don't think so - maybe in a future version. Though possibly you could code in sorting column headers . . .
Bob
Well, before I posted this I tried following this website >>> http://kryogenix.org/code/browser/sorttable/ and I saw that the column headers in the front end had little sorting arrows when I clicked on them, but nothing was being sorted. Is there a way to use what that website shows?
Hi tidusx18,
The code to do this exists in Joomla - but enabling it in ChronoConnectivity needs quite a it of work on the core code as it actually relies on new database calls to get the re-sorted data.
Bob
The code to do this exists in Joomla - but enabling it in ChronoConnectivity needs quite a it of work on the core code as it actually relies on new database calls to get the re-sorted data.
Bob
Hi Bob,
I was looking at Chrono Connectivity and can't the same code that is used to sort columns in the admin records display area be used in the front end to sort the record by column names? ๐ฒ
...hmm...๐
I was looking at Chrono Connectivity and can't the same code that is used to sort columns in the admin records display area be used in the front end to sort the record by column names? ๐ฒ
...hmm...๐
My 'where sql' code now looks like this
May I know where should I insert the code?
Thank you ๐
<?php
$search_array = array('<text_14', 'select_2');
$where = array();
foreach ( $search_array as $search ) {
$value = JRequest::getVar($search, '' , 'post');
if ( $value ) {
$where[] = " $search LIKE '$value%' ";
}
}
if ( !empty($where) ) {
echo " WHERE ".implode(' AND ', $where);
}?>
May I know where should I insert the code?
Hi Mukwano,
I'm not sure, you could try adding ORDER BY `field_name` in the WHERE box (after any where code).
Bob
Thank you ๐
You can insert the ORDER BY SQL statement at the bottom. Thats what I did and it worked fine. ๐
Daniel-
Daniel-
Hi Purple Knight,
Exactly as Daniel said - at the end after the 'where' code
Bob
Exactly as Daniel said - at the end after the 'where' code
if ( !empty($where) ) {
echo " WHERE ".implode(' AND ', $where);
}
echo " ORDER BY `some_field` ";
?>
Make sure to leave a space before so that it is separated from the end of the previous code.Bob
Just in case anyone needs any further help with this i've had a play around and got the headers to sort by either ascending or descending order
this is what i put in the WHERE SQL box
ORDER BY cf_id DESC
by adding this to the WHERE SQL box it will put the latest entry to the top
and by putting
ORDER BY cf_id ASC it will put the oldest entery to the top
hope this helps someone someday
this is what i put in the WHERE SQL box
ORDER BY cf_id DESC
by adding this to the WHERE SQL box it will put the latest entry to the top
and by putting
ORDER BY cf_id ASC it will put the oldest entery to the top
hope this helps someone someday
Awesome! Thanks a lot, Daniel, Bob & Infobuster, now it works well! ๐
Thanks.
Hi simonjoomla,
Yes, the same code should work in both versions.
The critical piece to do the sorting is
Bob
Yes, the same code should work in both versions.
The critical piece to do the sorting is
<?php
echo " ORDER BY cf_id DESC ";
?>
This needs to be in the 'Where' box - after any other record selection code you may have.Bob
Thank you very much. But may I know which file should I place the code you mentioned. e.g components\com_chronocomments\.... I don't really know which file you all are discussing to add the code to. thanks.
Hi Simonjoomla,
This is the ChronoConnectivity area of the Forums and the code goes in the ChronoConnectivity Where box.
Bob
This is the ChronoConnectivity area of the Forums and the code goes in the ChronoConnectivity Where box.
Bob
Got it! Thanks Bob. ๐
Warning: Invalid argument supplied for foreach()
Can't seem to get it. I'm not all that good @ constructing code. I just need the single table chronoforms_addcode to sort its frontend results by cf_id DESC and the above is the error i get.
I've have the results ordered by cf_id... can't seem to SORT them DESC
scratching head here.
Hi dgraham,
IIRC the current version of ChronoForms has an ORDER BY box, I think you can just add `cf_id` DESC in there. (I'm never certain if you need the 'ORDER BY' as well but I think not.)
Bob
IIRC the current version of ChronoForms has an ORDER BY box, I think you can just add `cf_id` DESC in there. (I'm never certain if you need the 'ORDER BY' as well but I think not.)
Bob
This topic is locked and no more replies can be posted.