Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

So there is a 2000 limit of rows per analytic snapshot, and there is an idea to remove that limit.

Until than:

How can I have more than 2000 rows from the Analytic Snapshot entered into Salesforce?

share|improve this question
add comment

2 Answers

In order to get around the limit of 2k for an analytic snapshot and prevent you from having to manually touch the data each day, week, month that you want your snapshot for, I would suggest using a Scheduled Batch Class. You would need to create your own custom object to hold your 'Raw Data', that is timestamped. You then use your Scheduled Batch Class to populate your new snapshot object with the data at your desired interval.

Example Scheduled Class

global class ScheduledBatchJob implements Schedulable{

    public static String schedule = '0 00 00 * * ?';  //Every Day at Midnight 

    global static String scheduleThisJob() {
        ScheduledBatchJob SBJ = new ScheduledBatchJob(); 
        return System.schedule('Your Job Name', schedule, SBJ);
    }

    global void execute(SchedulableContext sc) {

        MyBatchJob Batch = new MyBatchJob();
        ID batchprocessid = Database.executeBatch(Batch,100);           
    }
}

Example Batch Job (this will gather the "raw data" as you call it)

global class MyBatchJob implements Database.Batchable<sObject>{

    global final string query;

        //Example query, obviously Im sure you might even use another object
    global MyBatchJob(){
        query = 'Select Id, Name From Contact Where MailingState = \'MA\'';     
    } 

    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC,List<sObject> scope) {
        List<Snapshot_Custom_Object__c> objs = new List< Snapshot_Custom_Object__c >();

        //Assuming the snapshots you want are of Contact data
        for(Sobject s : scope){
            Contact c = (Contact) s;
            objs.add(new Snapshot_Custom_Object__c(
                 //Populate your Custom Object with data from the Contact
            ));
        } 
        insert objs; 
   }

   global void finish(Database.BatchableContext BC) {
        System.debug(LoggingLevel.WARN,'Batch Job is Complete!!!!!');
   }

}

So basically you query all the objects (Using Contacts in the above example), then you use the data from those objects to create your custom object for snapshot data. You insert all the snapshot data, and you now have this data without having to manually touch the data at each desired interval (Day, week, month, etc.)

share|improve this answer
1  
Consider rewording this answer in a way that does not refer to the other answer, since this is a complete answer by itself, but "sounds" like a comment to an answer, instead. Move the relevant parts that refer to the other answer as comments on the other answer. –  sfdcfox Dec 26 '13 at 14:24
    
I'll have to check that. Even that for now, my entire snapshot will consist of running it once, on 1/1/2014 morning :-) –  Saariko Dec 26 '13 at 14:35
    
@sfdcfox, good point. I have updated the answer to not reference the other answer directly, and added comment to the other answer with my comments. –  sfdc_ninja Dec 26 '13 at 14:56
add comment

Create the full report you want to have the analysis data for, and save it in tabular format (raw-data as I like to call it)

Export it to CSV file, and save locally.

Create a custom object, with ALL the fields in your report.

Using Data-Loader upload the records from the report into SF.

Now, you have a snapshot (remember to add a runtime or other date/time to the object) and you can work on it and report on it as you wish.

share|improve this answer
1  
Although this will definitly work, I would suggest using something a bit less manual. I have added another answer to that effect. –  sfdc_ninja Dec 26 '13 at 14:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.