• abhishekj25
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Hi All,

 

I want to create functionality for uploading image or logo in salesforce.

I am facing an issue when I tried to create an object of standered object Document in Unlimited Edition with 28.0 version.

 

Below is code :

 

public with sharing class UploadLogoForProfiles

{

  public Document document {
    get {
      if (document == null)
        document = new Document();

         // Error: Compile Error: Constructor not defined: [Document].<Constructor>() at line 6 column 20
      return document;
    }
    set;
  }
 
  public PageReference upload()

  {
 
    document.AuthorId = UserInfo.getUserId();
    document.FolderId = UserInfo.getUserId();
 
    try

         {
           insert document;
          }

         catch (DMLException e)

          {
                     ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error occured'));
                      return null;
           }

         finally

         {
             document.body = null;
             document = new Document();
         }
 
    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Success.'));
    return null;
  }
 
}

 

Please help me to resolve this issue.

 

Hi ,

 

I have some doubts .

I have some data which contains %complete and status [complete or incomplete] as both fields.

I created custom class and add this these 2 fields in this class.

Then I created 2 objects of this class and assign values and then added these 2 objects in custom list.

Then I want to loop out the list and create pie chart and display it in different row.

 

I am able to do it  , but here  2 charts are coming in only one row and this is not expected , I want each row contains only one pie chart.

 

Below is code snippet for controller:

 

public class TestGraph
{
    Public List<PieWedgeData> getData{get;set;}
    Public List<Show> s{get;set;}
    Public List<PieWedgeData> getData1{get;set;}
   
    
    public TestGraph()
    {
        getData = new List<PieWedgeData>();
        
        PieWedgeData obj = new PieWedgeData('complete',40);
        PieWedgeData obj1 = new PieWedgeData('incomplete',60);
        getData.add(obj);
        getData.add(obj1);
       
       
        Show objs = new Show();
        objs.displayname = 'public site 1';
        objs.placedata = getData;
       
         s=new  List<Show> ();
        s.add(objs);
      
        
        
        getData1 = new List<PieWedgeData>();
        
        PieWedgeData obj3 = new PieWedgeData('complete',10);
        PieWedgeData obj2 = new PieWedgeData('incomplete',90);
        getData1.add(obj3);
        getData1.add(obj2);
       
       
        Show objs1 = new Show();
        objs1.displayname = 'public site 2';
        objs1.placedata = getData1;
       
       
      
        s.add(objs1);
    }
    
    public class PieWedgeData
    {
        public String name { get; set; }
        public Decimal data { get; set; }
        public PieWedgeData(String name, Decimal data)
        {
            this.name = name;
            this.data = data;
        }
    }
    
    public class Show
    {
       public String displayname {get;set;}
       public List<PieWedgeData> placedata {get;set;}
    }
}

 

below is visualforce code :

 

<apex:page controller="TestGraph">
 
  <apex:PageBlock >
 
              <apex:pageBlockTable value="{!s}" var="wrap" align="CENTER">
                  <apex:column headerValue="Name" value="{!wrap.displayname}"/>
                  <apex:column headerValue="% Complete">
                  <apex:chart height="200" width="300" data="{!wrap.placedata}" >
                    <apex:pieSeries dataField="data" labelField="name" showInLegend="true" highlight="true"/>
                </apex:chart>
                </apex:column>
              </apex:pageBlockTable>
 
  </apex:PageBlock>       
 
</apex:page>

 

but in output of above result both charts are displaying in first row means in  public site 1 row 

where as per expectation  second chart should come in another row means in public site 2 .

 

 

 

 anyone please help me to resolve this issue.

Hi All,

 

I want to create functionality for uploading image or logo in salesforce.

I am facing an issue when I tried to create an object of standered object Document in Unlimited Edition with 28.0 version.

 

Below is code :

 

public with sharing class UploadLogoForProfiles

{

  public Document document {
    get {
      if (document == null)
        document = new Document();

         // Error: Compile Error: Constructor not defined: [Document].<Constructor>() at line 6 column 20
      return document;
    }
    set;
  }
 
  public PageReference upload()

  {
 
    document.AuthorId = UserInfo.getUserId();
    document.FolderId = UserInfo.getUserId();
 
    try

         {
           insert document;
          }

         catch (DMLException e)

          {
                     ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error occured'));
                      return null;
           }

         finally

         {
             document.body = null;
             document = new Document();
         }
 
    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Success.'));
    return null;
  }
 
}

 

Please help me to resolve this issue.