0

How to display the number of records in .csv file import in the visualforce page. I am able to import csv file and display the records in VF page, but I don't know how to display the record count in VF page. Can anyone give suggestions.

  • How you display in VF page ? – NITHESH K Aug 10 '17 at 11:47
  • @NITHESHK It is possible to show record count on vfpage form csv file – Riyaarun Aug 10 '17 at 11:49
  • 1
    If your able to displaying through list in Vf page then you can use {!List.size } to display your list size directly. – NITHESH K Aug 10 '17 at 12:07
1

As NITHESH mentioned, the best bet is probably to use the size method.

Based on where the code that processes the CSV is and how you're handling it, you could put the size request in the controller or in the VF page.

In the controller, it would be something like this:

public integer getRecordCount(){
    return publicRecordList.size();
}

and in the Visualforce page, just reference it with:

{!recordCount}

Conversely if the list is available in VF and you're just using an apex:repeat to show it, which is a likely possibility, then simply using what NITHESH said in your VF page would be perfect.

{!listVariable.size}

Just make sure that where ever you're showing that count, for either method, you have a re-render happening after the file uploads if it's all on the same page, so the size will have the newest value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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