Rashmi,
Here is one way it can be done, however it might not be useful due to performance. I present this to spark ideas... Overview: Using SQL, create a SQL View that includes a calculated column. This column would contain the sort order based on whatever criteria you require. Then create an ARS View form on top of this SQL View. Your table field would reference this calculated column to sort the records on screen. Here is the SQL View: CREATE VIEW dbo.uvw_MySQLViewForARS AS SELECT Summary, Last_Modified_Date, Priority, State, dbo.udf_SortOrder AS SortOrder FROM dbo.SHR_ConsolidatedList Here is the function: CREATE FUNCTION dbo.udf_SortOrder ( @Last_Modified_Date INT, @Priority INT, @State INT ) RETURNS VARCHAR(20) BEGIN DECLARE @SortOrder VARCHAR(20) SET @SortOrder = CONVERT(VARCHAR,@Last_Modified_Date) + '|' + CONVERT(VARCHAR,@Priority) + '|' + CONVERT(VARCHAR,@State) IF @State = 0 AND @Priority = 1 AND (SELECT * FROM dbo.uvw_CurrentRemedyTime) > (@Last_Modified_Date + (45 * 60)) RETURN '0|' + @SortOrder RETURN '1|' + @SortOrder END Add whatever other parameters to the function you may need for sorting. For criteria that matches your condition prefix a number. In this example there is only one condition, so I am using only a 0 and a 1 to provide the proper sorting. If you had 5 conditions then you would use numbers 0-5 (or 1-6, or 100 - 105, etc.). Here is the SQL View that the function needs to get the current date/time in Remedy time. *With SQL Server you can't use a non-deterministic value (such as GETDATE()) directly, so you have to use a View to return the value. CREATE VIEW [dbo].[uvw_CurrentRemedyTime] AS SELECT DATEDIFF(s, '01/01/1970', GETDATE()) CurrentRemedyTime HTH Stephen Remedy Skilled Professional ________________________________ From: Action Request System discussion list(ARSList) [mailto:[EMAIL PROTECTED] On Behalf Of Rashmi Amruth Sent: Monday, March 24, 2008 1:09 AM To: arslist@ARSLIST.ORG Subject: Re: Moving records to the top based on a condition ** Hi Joe, The table records are being retrieved from a view form. But this view form already has sort criteria set for existing records. Now, I need to sort only a subset of these records for the criteria which I have defined. Thanks, Rashmi _______________________________________________________________________________ UNSUBSCRIBE or access ARSlist Archives at www.arslist.org Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"