0

Here is the code of the visualforce page:

public class moderatorpanelCtrl
{
    Task tk;
    public list< LoginHistory>  Task {get;set;}
    
    public list< TopicAssignment>  TP {get;set;}
    public list< userActivity>  ua {get;set;}

 
     public moderatorpanelCtrl()
     {
        ua = new list< userActivity>();
        task = [select Id, UserId, LoginTime, NetworkId, Status from LoginHistory where NetworkId = '...'  order by LoginTime desc limit 10];
        for (LoginHistory lh :task){
            userActivity u = new userActivity();
            u.activitydate = lh.LoginTime;
            u.username = lh.UserId;
            u.Status = lh.Status;
            ua.add(u);
        }

        TP = [select Id, NetworkId, TopicId, Topic.Name, Topic.Description, Topic.NetworkId, Topic.CreatedDate, Topic.CreatedById, Topic.CreatedBy.Name, Topic.TalkingAbout, Topic.ManagedTopicType, Topic.SystemModstamp, EntityId, EntityKeyPrefix, 
        EntityType, CreatedDate, CreatedById, IsDeleted, SystemModstamp from TopicAssignment where NetworkId = '...' order by SystemModstamp desc limit 10];
     
    for (TopicAssignment ta :TP){
        userActivity u = new userActivity();
        u.activitydate = ta.SystemModstamp;
        u.username = ta.Topic.CreatedBy.Name;
        u.Status = ta.Topic.Name;
        ua.add(u);
    }
     
    system.debug('list of user activity'+ua);
    //ua.sort();
}

public class userActivity {
    public DateTime activitydate {get;set;}
        public string username {get;set;}
        public string Status {get;set;}
    }
}

1 Answer 1

1

Your class userActivity must implement the Comparable interface. This will enable you to call sort().

Presumably, your implementation will use the activitydate field to sort records.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .