• Naveen Madaan
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
Hi I am uploading a csv file in visual force page and also wants to display the records on page, but while displaying the data i am getting error of regex too complicated or out of bound index. my file contains 32 columns and 834 rows.

Can any one provide me the solution for this.
my apex code is : <apex:page sidebar="true" controller="FileUploader">
   <apex:form >
      <apex:sectionHeader title="Upload data from CSV file"/>
      <apex:pagemessages />
      <apex:pageBlock >
             <center>
              <apex:inputFile value="{!contentFile}" filename="{!nameFile}" /> 
              <apex:commandButton action="{!ReadFile}" value="Upload File" id="theButton" style="width:70px;"/>
               </center>  
      
      
      <apex:pageblocktable value="{!uploadedAccounts}" var="acc">
          
              <apex:column value="{!acc.address__c}"/>
          
        
              <apex:column value="{!acc.Bathrooms__c}"/>
          
      
              <apex:column value="{!acc.bedrooms__c}"/>
         
         <apex:column value="{!acc.call_attempt__c}"/>
        
         <apex:column value="{!acc.city__c}"/>
        
         <apex:column value="{!acc.create_date__c}"/>
        
           <apex:column value="{!acc.Full_name__c}"/>
          
            <apex:column value="{!acc.last_call_date__c}"/>
         
         <apex:column value="{!acc.last_call_result__c}"/>
        
         <apex:column value="{!acc.list_agent__c}"/>
         
         
         <apex:column value="{!acc.listing_status__c}"/>
         
          <apex:column value="{!acc.list__c}"/>
         
         
         <apex:column value="{!acc.list_price__c}"/>
         
         
          <apex:column value="{!acc.MLS_ID__c}"/>
                 
          <apex:column value="{!acc.MLS_name__c}"/>
        
         
       <apex:column value="{!acc.notes__c}"/>
       
         <apex:column value="{!acc.phone_1__c}"/>
        
          <apex:column value="{!acc.phone_2__c}"/>
         
          <apex:column value="{!acc.phone_3__c}"/>
       
           <apex:column value="{!acc.property_type__c}"/>
         
          <apex:column value="{!acc.source__c}"/>
   
         
          <apex:column value="{!acc.square_footage__c}"/>
         
             <apex:column value="{!acc.state__c}"/>
      
         
             <apex:column value="{!acc.status_change_date__c}"/>
        
         <apex:column value="{!acc.tax_address__c}"/>
         
         <apex:column value="{!acc.tax_city__c}"/>
       
         
         <apex:column value="{!acc.tax_name__c}"/>
         
         <apex:column value="{!acc.tax_postal_code__c}"/>
                 
         <apex:column value="{!acc.tax_srate__c}"/>
        
         
         
             <apex:column value="{!acc.Zip_code__c}"/>
         
        
        </apex:pageblocktable>
</apex:pageblock>
</apex:form>
</apex:page>

and class is :
public class FileUploader 
{
    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    String[] filelines = new String[]{};
    List<real__c> accstoupload;
    
    public Pagereference ReadFile()
    {
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        accstoupload = new List<real__c>();
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
            real__c a = new real__c();
            a.phone_1__c = inputvalues[0]; 
            a.phone_2__c = inputvalues[1];        
            a.phone_3__c = inputvalues[2];
           accstoupload.add(a);
        }
        try{
        insert accstoupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
        return null;
    }
    
    public List<real__c> getuploadedAccounts()
    {
        if (accstoupload!= NULL)
            if (accstoupload.size() > 0)
                return accstoupload;
            else
                return null;                    
        else
            return null;
    }   
    }
Hi plz go through my apex page code and class. I wants to view my field records on visual force page and wans to update a field Login__c.
but i am just getting a save button and nothing else. 
MY VF page code is :
<apex:page Controller="contr">
<apex:form >
 <apex:pageBlock title="Student Record">
  
      <apex:pageBlockButtons >
      <apex:commandButton value="Save" action="{!save}"/>
   </apex:pageBlockButtons>
      <apex:pageBlockTable value="{!empl}" var="emp">
         <apex:column value="{!emp.status__c}"/>
        
         <apex:column value="{!emp.Name_emp__c}"/>
         
         <apex:column headerValue="enter login">
         <apex:inputField value="{!emp.Login__c}"/>
      </apex:column>
    </apex:pageBlockTable>
</apex:pageBlock>
  
        </apex:form>

</apex:page>

My class contr is :
public class contr {

  public View_attend__c acc{get;set;}  
List<view_attend__c> mylist = new List<view_attend__c>();
 public view_attend__c getempl() {
   
    string st='';
    st = ApexPages.currentPage().getParameters().get('id');
    mylist = [SELECT Login__c,status__c,Name_emp__c FROM view_attend__c where Name_emp__c =:st];
    
 return acc;
}
 

    public PageReference save() {
        update acc;
        return null;
    }
}

How i can fix it and get the results.


 
i am geetting error in visual force when i am going to show my data in list and updating it.

public class contr {

  public View_attend__c acc{get;set;}  

 public view_attend__c getempl() {
    List<view_attend__c> my = newList<view_attend__c>();
    string st='';
    st = ApexPages.currentPage().getParameters().get('id');
    Listmy = [SELECT Login__c,status__c,Name_emp__C FROM view_attend__c where Name_emp__c =:st];
     if(my.isEmpty() == false){
      acc = my[0];
    else{
      ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'The Account ID is invalid.');
      ApexPages.addMessage(msg);
    }
   
        
        return acc;
    }

    public PageReference save() {
        update acc;
        return null;
    }
}
Hi plz go through my apex page code and class. I wants to view my field records on visual force page and wans to update a field Login__c.
but i am just getting a save button and nothing else. 
MY VF page code is :
<apex:page Controller="contr">
<apex:form >
 <apex:pageBlock title="Student Record">
  
      <apex:pageBlockButtons >
      <apex:commandButton value="Save" action="{!save}"/>
   </apex:pageBlockButtons>
      <apex:pageBlockTable value="{!empl}" var="emp">
         <apex:column value="{!emp.status__c}"/>
        
         <apex:column value="{!emp.Name_emp__c}"/>
         
         <apex:column headerValue="enter login">
         <apex:inputField value="{!emp.Login__c}"/>
      </apex:column>
    </apex:pageBlockTable>
</apex:pageBlock>
  
        </apex:form>

</apex:page>

My class contr is :
public class contr {

  public View_attend__c acc{get;set;}  
List<view_attend__c> mylist = new List<view_attend__c>();
 public view_attend__c getempl() {
   
    string st='';
    st = ApexPages.currentPage().getParameters().get('id');
    mylist = [SELECT Login__c,status__c,Name_emp__c FROM view_attend__c where Name_emp__c =:st];
    
 return acc;
}
 

    public PageReference save() {
        update acc;
        return null;
    }
}

How i can fix it and get the results.


 
i am geetting error in visual force when i am going to show my data in list and updating it.

public class contr {

  public View_attend__c acc{get;set;}  

 public view_attend__c getempl() {
    List<view_attend__c> my = newList<view_attend__c>();
    string st='';
    st = ApexPages.currentPage().getParameters().get('id');
    Listmy = [SELECT Login__c,status__c,Name_emp__C FROM view_attend__c where Name_emp__c =:st];
     if(my.isEmpty() == false){
      acc = my[0];
    else{
      ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'The Account ID is invalid.');
      ApexPages.addMessage(msg);
    }
   
        
        return acc;
    }

    public PageReference save() {
        update acc;
        return null;
    }
}