Buy Now
Sign in

Sort Code

har7801 , October 11 2012
H
har7801
I have used the tutorial for V4 and got the database working well, the tutorial for multi record loading. Now that I am getting a few records, is that a line I can enter into the custom code section that will sort the results by a field (cf_id) in a descending order.

Cheers

Mick.
admin
Hi Mick,

Please check the "Order Fields" field in the "Multi Record loader" action under the "Data displayer" tab.

Regards,
Max
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
H
har7801
Thanks Heaps,

Is there anyway to reverse the sort order doing that?
GreyHead
Hi Mick,

I don't think that you can specify ASC or DESC in the DB Multi-Record Loader (I just tried and nothing was ordered). If you aren't using the Data Displayer then you could use a custom Code action to reverse the order of the array. Or you could try adding an extra column to your table and set it to be the negative of the cf_id.

Later: I just looked at the code and there is a workaround.

First you must enable Pagination (I don't quite know why). Then use a Custom Code action before the DB Multi Record Loader and add code like this.
<?php
if ( !isset($form->data['order']) || !$form->data['order'] ) {
$form->data['order'] = 'cf_id';
if ( !isset($form->data['direction']) || !$form->data['direction'] ) {
$form->data['direction'] = 'DESC';
}
}
?>

Bob

Later still: I added this FAQ
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much