function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tdevmantdevman 

vf question

If we were to create a vf dashboard from a external file system ..csv or .txt that contains a 1 million records, is there anyway to get passed the 1000 vf collection limit

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

I believe that aggregate queries when the visualforce page is marked as read only don't count against the governor limits.  That's a fairly recent change and I can't remember exactly when it came in.

All Answers

bob_buzzardbob_buzzard

One way that I've worked around this limit in the past is to have a list that contains lists - e.g. I have a list with 1k entries, each of which is another list containing up to 1k entries.  That said, I haven't tried to go up to 1 million records - I suspect you'd start hitting some heap problems with those volumes.

tdevmantdevman

thank you so much bob..i think have an idea how to iterate through the list of list and i see your point on the heap limit which i will monitor in the debug log. another question i have is if the dashboard doesn;t contain salesforce data at all, should i be using  vfcompononent or would this be better to use a .js library like sencha? there would be other dashboard components on this page such as pie and scatter graphs which i know i can use standard charting components but some of the dashboards on this page are purely based on external data that need to be invoked everytime the page runs so async...any ideas

bob_buzzardbob_buzzard

I guess it depends on how easily you can access the files from Javascript - that's not something I've done.

 

I've used dojo charting a lot in the past if that's any help.

tdevmantdevman

thank you bob, i will check this out. another question on the LDV .csv. is there a possibility for the vf chart to load all the data with batch apex? if my limit does increase, and the volume is fairly large from external file the response return from the job in batch apex i would think may take some time without providing an immediate response to the user..could this even be done? i think it's going to be complex a bit later since the data from the external file may need to be used to inconfjuctionwith sfdc data to produce the information on the dashboard..so may need to combine ajax requests in js combined with counts from soql.uugh..

bob_buzzardbob_buzzard

Batch apex is decoupled from the Visualforce - your batch would have no way to communicate with the VF page.

 

You can do this sort of thing using batch, but you have to write the records to the database (so kiss goodbye to a couple of Gb of storage) and mark the visualforce as readonly which allows you to retrieve up to 1 million records.

tdevmantdevman

Thanks Bob, make sense. Looks like really the only way is to use .js library and try to use client side code with ajax requests to the external file and display that within a apex page tag but . coupling that with visualforce i think will run into too many governor limit so probably not something we can do

 

question i have also is with with vfcharting with data in sfdc, do the same limits apply when i run soql queries into a collection or have those increased to use same limits as ootb reporting? let's say i have 10 mil records in a financial_transaciton object to summarize im pie graph perhaps I could use a select count to do this rather than query each row..

bob_buzzardbob_buzzard

I believe that aggregate queries when the visualforce page is marked as read only don't count against the governor limits.  That's a fairly recent change and I can't remember exactly when it came in.

This was selected as the best answer
tdevmantdevman

Thanks Bob. Sorry another question is if i use js to pull in all external data from a csv into a visualforcechart, do state limits still apply? I think this is still true even though it's not sfdc data since it's rendered in the browser within an apex tag

bob_buzzardbob_buzzard

If you were using a visualforce chart then the data has to be supplied from the controller, so those limits apply.  You could make the values transient, which means they won't go into the viewstate.

tdevmantdevman

got it thank you