sorting records in the middle of a if/then/else

Discussion created by bobinaustin on Aug 7, 2016
Latest reply on Aug 8, 2016 by bobinaustin

So i have a set of records that has a date and time on them.  I have a script that allows a user to search for a phone number and then go to the found set.  Currently the order of the found set is showing the first record first and I want it to show the most recent record first.  Or the last record first.  Because the script does this search and if there is no phone number found the script goes to one page and if it finds a phone number it goes to another page.  I have tried applying a sort before the else statement in the script but its not sorting like i want.  Any ideas?