• Michael3.Brown
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 31
    Replies

Hello. I have a VisualForce page in which I create a bar graph. I have 5 forms I stack on top of each other, with each form respresenting a different probability associated with my records: Low, Med, High, DNR, or Done. Each form is a one-cell table I highlight in a different color. As long as each probability is accounted for, all my forms stack on top of each other correctly.

For example:

[LOW]

[MED]

[HIGH]

[DNR]

[DONE]

 

However, if one of my form has no records associated with its probability, I use JavaScript to hide that form. However, instead of having the next form slide down, **bleep** remains in place, as if the hidden form is still there. For example, if I remove the "Done" probability form, I see something like:

[LOW]

[MED]

[HIGH]

[DNR]

* whitespace *

 

Instead of sliding down to the bottom, the "DNR" probability form stays where it is. I'm not sure why this occurs, as the rest of the forms seem to stack on each other correctly.

Here is my code:

<SCRIPT language="javascript" type="text/javascript">
function hideForms()
{
    if ({!graphDoneQ3} == '0')
    {
        document.bargraphDone.style.display = "none";
    }
    
    if ({!graphLowQ3} == '0')
    {
        document.bargraphLow.style.display = "none";
    }
    
    if ({!graphMedQ3} == '0')
    {
        document.bargraphMed.style.display = "none";
    }
    
    if ({!graphHighQ3} == '0')
    {
        document.bargraphHigh.style.display = "none";
    }
    
    if ({!graphDNRQ3} == '0')
    {
        document.bargraphDNR.style.display = "none";
    }
    

}


<TD valign="bottom" height="500">
        <FORM name="bargraphLow">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphLowQ3}">
            <TR><TD bgcolor="red" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphMed">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphMedQ3}">
            <TR><TD bgcolor="yellow" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphHigh">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphHighQ3}">
               <TR><TD bgcolor="green" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphDNR">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphDNRQ3}">
            <TR><TD bgcolor="gray" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphDone">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphDoneQ3}">
            <TR><TD bgcolor="#000000" width="30"></TD></TR></TABLE></FORM></TD>

 

 

 If anyone could provide insight into why this stacking error might be happening, I would greatly appreciate it.

 

Thanks!

Mike





I have a custom object in SalesForce called Pipeline_Tracker__c. One of the fields on this object is "Owner." On my VisualForce report, I have a table set up with <apex:repeat> tags to display all the records in my Pipeline Tracker object.  When it comes to the owner field, I want to be display it as long as there is a value. However, if no owner is listed, I want to instead display the Account owner from the related account object..

 

Is there a way to do something like this in VisualForce? Basically, "if Owner__c" is null, display Account__r.Owner"

 

Thanks,

Mike

So, I have a custom report I have built in Visual Force. I am trying to display the record name so that if a user wants to, they can click it, which will then allow them to open the record in SalesForce.

 

I have the similar functionality for Lookup fields.. I have a field called "Owner," which is a lookup to a SalesForce user.

I also have a field entitled "Customer" which looks up an Account on Salesforce.

 

On my VisualForce page, I display these two fields as:

<apex:repeat value="{!records}" var="a">
<TR><TD width="9%"><apex:outputField value="{!a.Owner__c}" /></TD>
<TD width="9%"><apex:outputField value="{!a.Customer__c}" /></TD></TR></apex:repeat>

 When these two fields are displayed, they are underlined, and I am able to click them and open up the corresponding Account Object or User Object in SalesForce. I wish to do the same for the Record Name.

 

I tried using:

<TD width="9%"><apex:outputField value="{!a.Name}" /></TD>

 However, this only displays the text, and it does not provide a link to the record. Is there a way I can enable the record name to be clicked in order to open the record in SalesForce?

 

Thanks!

Mike

 

Hello, On my VF page, we wish to display numbers as whole numbers, so I have used the round function to round the numbers appropriately.

 

<TD align="center">{!ROUND(subtotalAmericasMedQ1,0)}</TD>

 This is working on all my data, except for the number 10. Instead of diplaying "10" on the VF page, it displays "1E+1". 11 and 9 display correct, but for some reason the number 10 is changed to 1E+1. Has anyone else come across this error and have any tips I might be able to try to get it to actually display the number 10.

 

Thanks,

Mike

Hello,

 

I have a custom "Pipeline Tracker" object with a lookup relationship to the "Account" object. I am trying to run a test where I display all my records, pulling 1 field from the "Pipeline Tracker" object and 1 field from the "Account" object.

 

I am trying to do this by putting everything into a list, which I hope to call on my VF page. I haven't gotten any errors in building my list.

    List <Account> pipelineRecords = new List <Account> ();
    
    public void buildList()
    {
        for (Account acct: [SELECT Sales_Pole__c,  
            (SELECT Category__c FROM Pipeline_Tracker_3__r)
        FROM Account])
        {
            pipelineRecords.add(acct);
        }
    }

    public List<Account> getpipelineRecords()
    {
        return pipelineRecords;
    }

 

On my VF page, I have a simple test where I simply want to call every record from my list and display the "Sales Pole" field from the "Account" object and the "Category" field from the "Pipeline Tracker" object. 

 

Here is the code I have on my VF page.

<apex:page controller="MultipleDBJoin">
<TABLE>
<TH>Category</TH>
<TH>Sales Pole</TH>
  <apex:repeat value="{!pipelineRecords}" var="a">       
       <TR><TD width="75"><apex:outputText value="{!a.Category__c}" /></TD>
       <TD width="100"><apex:outputField value="{!a.Sales_Pole__c}" /></TD></TR>
  </apex:repeat>
</TABLE>
</apex:page>

 

I am getting an error saying that Category C is not found on the Account object. I think the problem lies in my List Creation where I specified my List as the Account type. But, it wouldn't let me create a List unless I established it with an object type, and if I set the List as the object type: Pipeline_Tracker_3__c, I would still get an error with Sales Pole.

 

Does anyone know how I can work around this issue? Can I create an SObject instead and iterate through that in order to display each record?

 

Thanks

Mike

Alright, I have 3 objects set up.

A custom Pipeline Tracker object used to track certain deals

The standard Account Object

A custom Account Team object

 

Both my Pipeline Tracker and Account Team custom objects relate to the Account object on the Account Name.  I need to set up an SOQL statement pulling data from all the objects. About 90% will come from the Pipeline Object and only a handful of fields will come from the Account and Account Team objects.

 

As a test, I've been trying to call 3 fields. One field from each record.

I can successfully call "Category" from the Pipelline Tracker object, and I can successfully relate my Pipeline Tracker to the Account Object and pull the field "Sales Pole" from the Account Object. However, I'm stuck at how to then relate the Account object to my Account Team object and pull the field, "Sales Director". Does anyone know the proper syntax to successfully call a related record of a related record?

 

    List<Pipeline_Tracker_3__c> pipelineRecords = new List <Pipeline_Tracker_3__c>();

    public MultipleDBJoin()
    {
        buildList();
    }

    public void buildList()
    {
        for (Pipeline_Tracker_3__c pt: [SELECT Category__c, Account__r.Sales_Pole__c, Account__r.Account_Team__r.SD__c
        FROM Pipeline_Tracker_3__c])
        {
            pipelineRecords.add(pt);
        }
    }

 

Thanks,

Mike

 

Hello, I have a VF page where I want to use two groups of <Apex:Repeat> tags. One will call from a custom object, while the other will call from the Account object.  I want to display a couple of fields from each object, on the same row, but I am having trouble. Ideally, I want my  table to look like the following

 

Car Type      Car Make      Car Model      Account

Truck             Ford                F150               AAA

Car                Lotus              Elise               BBB

SUV               Toyota            Rav4               CCC

 

However, I am ending up with the following display instead:

 

Car Type      Car Make      Car Model      Account

Truck             Ford                F150              

Car                Lotus              Elise              

SUV               Toyota            Rav4

AAA

BBB

CCC              

 

Here's the code I have for this table.

  <TABLE border="1" cellpadding="2" cellspacing="2">
  <TH width="75">Category</TH>
  <TH width="100">Account</TH>
  <TH width="40">Engine Project</TH>
  <TH width="75">Engine Model</TH>
  <TH width="75">Region</TH>
  
 
  <apex:repeat value="{!opportunities}" var="a">       
       <TR><TD width="75"><apex:outputText value="{!a.Type__c}" /></TD>
       <TD width="100"><apex:outputField value="{!a.Make__c}" /></TD>
       <TD width="40">{!a.Model__c}</TD></TR>
  </apex:repeat>
  <apex:repeat value="{!accounts}" var="b">
      <TR><TD width="75"><apex:outputField value="{!b.Account__c}" /></TD></TR>
  </apex:repeat>
  </TABLE>

 

The <TR> tags seems to be where my problem lies. I tried having only 1 group of <TR> tags. I originally placed <TR> following the first <apex:repeat> and </TR> right before the last </apex:repeat>. However, I got an error saying that I needed to have a matching <TR> tags.

 

There's got to be a way to get my Account names to line up on the records as they should. I would appreciate any insight!

 

Thanks,

Mike

 

Hello, I have a custom Pipeline Tracker object I am using.. On each record, there is a relationship field that relates each Pipeline record to an Account record. What I want to do is gather fields from both my custom Pipeline Tracker Object and the standard Account table, using the Account Name as the join between the tables. However, I'm having trouble joining the tables.

 

Here's the SQL statement I have:

        for (Pipeline_Tracker__c pt: [SELECT p.Category__c, p.Account__c, a.Region__c 
        FROM Pipeline_Tracker__c p, Account a        
        WHERE  RecordType.Name =: channel AND p.Account__c = a.Name])
        {
           
            opportunities.add(pt);
        }

 

I get an error on the last part of the where statement, saying a.Name is not recognized. However, I feel like the error may be at the beginning where I say for (Pipeline_Tracker__c pt). Do I need to get the account object in there somehow? 

 

I would appreciate any help on the matter.

 

Thanks!

Mike 

Hello, I am trying to insert a variable into an SQL statement rather than having to hard code the SQL statement. Basically, I'm trying to build a list of cars made by a certain company.

 

I have tried two methods

 

In the first, I basically put the SQL statement into a string and concatenate the car company on the end. However, I think I need to include single quotes around the car company, but I wasn't sure how to do this since single quotes are used to open and close string variables. This method gave me an error, saying I needed to iterate my for loop over a collective item.

List<Cars__c> carList = new List <Cars__c>();


List<Cars__c> getcarList()
{
        make = ApexPages.currentPage().getParameters().get('carmake');
        sqlquery = '[SELECT Make__c, Model__c FROM Cars__c WHERE Make__c = ' + make + ']';
        
        for (Cars__c carrecord : sqlquery)
        {
            carList.add(carrecord); 
        }
 return carList;
}

 

My other method was to include the SQL within the for loop and see if I could just call the variable, make, but then I get an error saying that "make" is not recognized.

List<Cars__c> carList = new List <Cars__c>();


List<Cars__c> getcarList()
{
        make = ApexPages.currentPage().getParameters().get('carmake');
                
        for (Cars__c carrecord : [SELECT Make__c, Model__c FROM Cars__c WHERE Make__c = make])
        {
            carList.add(carrecord); 
        }
return carList;
}

 

Does anyone have any insight into how I can use my make variable within my SQL statement?

 

Thanks!

Mike

Hello, I am working on a test involving the passing of variables. Basically, a user is on a splash page where they input some values in an HTML form, which are then passed to my Apex page to be used as parameters in Java Functions.

 

I am new to this, so I've created a simple test. I set up a Splash Page where a user uses a dropdown to select the make of a car. Based on their selection, this parameter is passed to my Java-Interacting Apex Page.  So far, I got this part working as the parameter of my HTML form was in my URL:

http://a.salesforce.com/apex/CarSales?carmake=Ford

 

Now, this is where I"m getting stuck. I want to use my apex Page to send this variable to one of my Apex Classes where it will call a Java Function.

 

Here is the Apex Code I have from the web interface. carmake represents the variable that was passed from the previous HTML form.

<apex:page controller="Cars">
{!getMake(carmake)}
</apex:page>

 Here is my Cars Class

public class Cars
{

String make;
    
    public String getMake(String c)
    {
        if (c == 'Ford')
        {
             make = 'You have selected Ford';
        }

        else
        {
             make = 'You have not selected Ford';
        }

        return make;
    }
}

 

 

However, the variable carmake does not seem to be recognized, as I am getting the error:

Error: Unknown property 'Cars.carmake'

If anyone could provide any insight, I would really appreciate it.

Thank you,

Mike

First, let me apologize if this is a dumb question. I'm trying to reach back and pull my college Java courses, but I'm struggling.

 

Anyways, I have a public void method that I want to query a custom object, and depending on a field value, add each record to a certain list. I am doing this because I have multiple lists I will be calling from my VisualForce page, so I have the public void method to build the lists, and then functions to return those lists. However, when I call my lists, none of them are populated with data, so it seems my public voide method is not ran.

 

Here is the public void method:

public class MarginEscalators
{
List<Pipeline__c> marginEscalatorsComplete = new List <Pipeline__c>();
List<Pipeline__c> marginEscalatorsIncomplete = new List <Pipeline__c>();

public void buildLists()
{           
                         
        for (Pipeline__c me2011 : [SELECT      
                 ProjectID__C, Sales_Pole__c, Status__C
        FROM Pipeline__c          
        WHERE Year__c = 2011)
            {
                if (me2011.Status__c == 'Complete')
                {
                    marginEscalatorsComplete.add(me2011);    
                }                
                
                else if (me2011.Status__c == 'Incomplete')
                {
                    marginEscalatorsIncomplete.add(me2011);    
                }                 
                              
            }     
}     
     
    

 

 Here are my two simple functions:

public List<Pipeline__c> getMarginEscalatorsComplete()
{
    return marginEscalatorsComplete;
}

public List<Pipeline__c> getMarginEscalatorsIncomplete()
{
    return marginEscalatorsIncomplete;
}

 

 

I assumed that whenever I called either {!marginEscalatorsComplete} or {!marginEscalatorsIncomplete} on my VF page my public void method would be kicked off automatically. Is there something else I need to do in order to initiate the public void method?

 

The code below is how I've tried calling just one of my lists to see if my code worked, but it's not. I'm not getting errors, but I am getting a blank page.

<TABLE>
<apex:repeat value="{!marginEscalatorsComplete}" var="a">       
     <TR><TD width="75"><apex:outputText value="{!a.Subcategory__c}" /></TD>
         <TD width="100">{!a.ProjectID__c}</TD>
         <TD width="40">{!a.Sales_Pole__c}</TD>
         <TD width="75">{!a.Status__c}</TD></TR>
</apex:repeat>
</TABLE>

 

Again, I think it's because my public void method is not get initiated and building the lists, and I'm not sure how to make sure it is run. If anyone has any insight, I would greatly appreciate it.

 

Thanks,

Mike

Hello,

 

I was working on my visual force page with some Javascript. I noticed it wasn't triggering, so I made my code as simple as possible: to generate a popup as soon as the page loads. However, my code will not work. I copied my code into another one of my VisualForce pages, and it works there, but I cannot figure out why it won't work in this specific page.

 

<script language="javascript" type="text/javascript">
function hideEmptyRows()
{        
    alert('test');
}    
</script>
<body onLoad="hideEmptyRows()">

 I'm having trouble understanding why this would work on one VisualForce page, but not another.

Hello,

 

I have the following code which stores all of my my records for a given object into a custom list: totalRecords. I have a VF page that simply displays each record in this list.

 

public class ListView 
{

List<Pipeline_Tracker_Ver_2__c> totalrecords = new List <Pipeline_Tracker_Ver_2__c>();
Integer total;

    public List<Pipeline_Tracker_Ver_2__c> getTotalRecords()
    {            
                
        for (Pipeline_Tracker_Ver_2__c tr : [SELECT         
                 Sales_Pole__c,  Probability__c, Q1_Revenue__c,
        FROM Pipeline_Tracker_Ver_2__c          
        WHERE Year__c = '2011'])
            {                       
                total = total + tr.Q1_Revenue__c; 
                totalrecords.add(tr);                     
            }    
        
        return totalrecords;
    }

    public Integer getgrandTotal()
    {
        return total;
    }
    
}

 

 

Whenever I take out the variable, total, my list populates fine on my VF page. However, my statement:

totalrecords.add(tr); 

 seems to be causing problems. When I save my Apex Class, there are no errors, but when I try and load my VG page, I receive:

 

 

point System.NullPointerException: Attempt to de-reference a null object
Class.ListView.getTotalRecords: line 26, column 51 External entry point

 

 

Can anyone provide any insight into what I might be doing wrong. Am I calculating the total incorrectly since it seems to be finding a null value?

 

Thanks!

Mike

Hello, I followed the tutorials to create a VisualForce page that lists all the records on my object:

 

 

    public DisplayMarginEscalators[] getMarginEscalators()
    {
    
        if (marginescalatorsHigh == null)
        {
            marginescalatorsHigh = new DisplayMarginEscalatorsHigh[]{};
        
            for (Pipeline_Tracker__c pt : [SELECT Subcategory__c, Account__c,        
                 Sales_Pole__c, Probability__c, Q1_Revenue__c, SD_Owner__c,
FROM Pipeline_Tracker__c WHERE Year__c = 2011]) { marginescalators.add(new DisplayMarginEscalators(pt)); } } return marginescalators; }

 However, what I want to do is see if I can create another method that sets up a loop to go through my record collection and collect a total amount for the object: Q1_Revenue__c. I'm not sure how to do this, though.

I've been playing around with a for loop:

 

Integer x;
Integer total;
public Integer getTotal()
{
   for (x=0;x<marginescalators.size();x+1)
   {
       total = total + marginescalators[x].Q1_Revenue__c;
   }
}

 

But, I'm having trouble getting it working. Does anyone have any insight into how I can collect the running total for this amount? Please note, that I cannot use a SUM function because I have already used up my limit for SOQL queries.

Hello,

 

I was hoping to find out how I can call an additional controller on my VF page.

 

Is thre a setting I can use in the <apex:page> tags?

I tried

<apex:page controller="Controller 1">

*code

</apex:page>

 

<apex:page controlller="Conroller 2>

** code

</apex>

 

But, I was gettin errors in doing this.

 

Thanks,

Mike

Hello, I have an SQL statement returns the count of of the number of records in my object:

 

countrecord = [SELECT COUNT(Probability__c)totalcount FROM Pipeline_Tracker_Ver_2__c];

 

I want to convert this to an integer, and add the value 1, so that I can set this as a dynamic value for ROWSPAN on one of my tables. I figured that since I am returning a count, I should be able to easily convert this to an integer. I have been trying the formula:

 

public Integer count;
count = integer.valueof(countrecord) + 1;

 

However, I get the following error. It seems to be getting totalcount correct, which is 2, but I'm not sure why it's an invalid integer, or what they mean by external entry point.

 

System.TypeException: Invalid integer: [AggregateResult (totalcount:2)]

 

Class.MarginEscalatorsThermometerChart_Q1_2011.getCount: line 231, column 17 External entry point

 

Any insight would be great, as I'm not sure what else to try.

 

Thanks!

Mike

Hello, I have a data table I've created on a Visual Force page. This table lists out all my records I've created for a custom Sales object. I was asked to gather the total amount cummulated for each record and display it on the top row (not counting the Header Values). I have come up with the total amount, but I am having trouble getting it to display the way I want.  

 

Here's an example of the layout I need.  I want the Total amount to display directly underneath the header row.

Total   Employee   Amount

$350    Mike            $50

           Steve           $100

           Perry           $150

           Johnson      $50

 

However, here is what I am getting using the following code:

 <apex:column headerValue="Total" width="50">
        <apex:facet name="header"><apex:outputPanel >
        <apex:outputText value="${!Total['sum']}" /></apex:outputPanel></apex:facet>
</apex:column>

 This code takes my header value "Total" and replaces it with the numeric total, so I am seeing:

 

$350    Employee   Amount

            Mike            $50

            Steve          $100

            Perry           $150

           Johnson       $50

 

I also decided to create my Headers using standard <TH> tags, rather than the <column headerValue="">, and then setup my dataTable without column headers.  However, this resulted in the following layout:

 

Total   Employee   Amount

$350

           Mike              $50     

           Steve            $100

           Perry            $150

           Johnson       $50

 

While the total amount is directly underneath the "Total" header, the other records have jumped down a line. Is there a way to get this total amount to display in my first layout?

 

Thanks!

Mike

Hello, I need to display the SUM of Cash collected for a certain employee, but I'm having trouble figuring out how.  Since I'm using the sum function, I plan on only having 1 field come back in my SQL Statement.

 

The SQL Statement I have is: Select Sum(CashCollection) From Sales Where employeeid='220066'

 

 

I created a very simple Apex class for this. Everything compiled without error, so I'm assuming it's correct, but I am still new to SalesForce SQL

 

public class CashCollection
{
    SObject sumCash;     
        
    public SObject getSumCash()  
    {
    sumCash = [SELECT SUM(CashCollection) sum FROM Sales__c WHERE employeeid__c = '220066'];
    return sumCash;
   }
}

 

 

My Visual Force page is where I'm struggling on how to pull my sum value.  Here's the code I have, but I'm getting an unrecognizable property error: "CashCollection.sumCash not recognizable"

 

<apex:page controller="CashCollection">
    <apex:dataTable value="{!sumCash}" var="temp">  
        <apex:column >
            <apex:outputText value="${!temp.sumCash.sum}"/>
        </apex:column>
    </apex:dataTable>
</apex:page>

 If anyone could help provide insight into this, it would be great.

 

Thanks!

Mike

Hello, I have created a VisualForce page that calls an SSQL statement and displays the records in my database. All my fields are displaying correctly, except my "Owner" field, which is a user lookup.

 

On this field, the User ID is displaying instead of the User name.

 

For example, I am seeing:

Owner

00530000004FXC5AAO

00530000004FYJJAA4

 

when I really want to be seeing

Owner

Steve Perry

Leroy Jenkins

 

 

My The object API for Owner is called: Owner__c. Do I need to attach an attribute to this in order to see the user's name rather than their ID?

Hello. I have a VisualForce page in which I create a bar graph. I have 5 forms I stack on top of each other, with each form respresenting a different probability associated with my records: Low, Med, High, DNR, or Done. Each form is a one-cell table I highlight in a different color. As long as each probability is accounted for, all my forms stack on top of each other correctly.

For example:

[LOW]

[MED]

[HIGH]

[DNR]

[DONE]

 

However, if one of my form has no records associated with its probability, I use JavaScript to hide that form. However, instead of having the next form slide down, **bleep** remains in place, as if the hidden form is still there. For example, if I remove the "Done" probability form, I see something like:

[LOW]

[MED]

[HIGH]

[DNR]

* whitespace *

 

Instead of sliding down to the bottom, the "DNR" probability form stays where it is. I'm not sure why this occurs, as the rest of the forms seem to stack on each other correctly.

Here is my code:

<SCRIPT language="javascript" type="text/javascript">
function hideForms()
{
    if ({!graphDoneQ3} == '0')
    {
        document.bargraphDone.style.display = "none";
    }
    
    if ({!graphLowQ3} == '0')
    {
        document.bargraphLow.style.display = "none";
    }
    
    if ({!graphMedQ3} == '0')
    {
        document.bargraphMed.style.display = "none";
    }
    
    if ({!graphHighQ3} == '0')
    {
        document.bargraphHigh.style.display = "none";
    }
    
    if ({!graphDNRQ3} == '0')
    {
        document.bargraphDNR.style.display = "none";
    }
    

}


<TD valign="bottom" height="500">
        <FORM name="bargraphLow">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphLowQ3}">
            <TR><TD bgcolor="red" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphMed">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphMedQ3}">
            <TR><TD bgcolor="yellow" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphHigh">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphHighQ3}">
               <TR><TD bgcolor="green" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphDNR">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphDNRQ3}">
            <TR><TD bgcolor="gray" width="30"></TD></TR></TABLE></FORM>
        <FORM name="bargraphDone">
            <TABLE border="1" bordercolor="black" cellspacing="0" cellpadding="0" height="{!graphDoneQ3}">
            <TR><TD bgcolor="#000000" width="30"></TD></TR></TABLE></FORM></TD>

 

 

 If anyone could provide insight into why this stacking error might be happening, I would greatly appreciate it.

 

Thanks!

Mike





I have a custom object in SalesForce called Pipeline_Tracker__c. One of the fields on this object is "Owner." On my VisualForce report, I have a table set up with <apex:repeat> tags to display all the records in my Pipeline Tracker object.  When it comes to the owner field, I want to be display it as long as there is a value. However, if no owner is listed, I want to instead display the Account owner from the related account object..

 

Is there a way to do something like this in VisualForce? Basically, "if Owner__c" is null, display Account__r.Owner"

 

Thanks,

Mike

So, I have a custom report I have built in Visual Force. I am trying to display the record name so that if a user wants to, they can click it, which will then allow them to open the record in SalesForce.

 

I have the similar functionality for Lookup fields.. I have a field called "Owner," which is a lookup to a SalesForce user.

I also have a field entitled "Customer" which looks up an Account on Salesforce.

 

On my VisualForce page, I display these two fields as:

<apex:repeat value="{!records}" var="a">
<TR><TD width="9%"><apex:outputField value="{!a.Owner__c}" /></TD>
<TD width="9%"><apex:outputField value="{!a.Customer__c}" /></TD></TR></apex:repeat>

 When these two fields are displayed, they are underlined, and I am able to click them and open up the corresponding Account Object or User Object in SalesForce. I wish to do the same for the Record Name.

 

I tried using:

<TD width="9%"><apex:outputField value="{!a.Name}" /></TD>

 However, this only displays the text, and it does not provide a link to the record. Is there a way I can enable the record name to be clicked in order to open the record in SalesForce?

 

Thanks!

Mike

 

Hello, On my VF page, we wish to display numbers as whole numbers, so I have used the round function to round the numbers appropriately.

 

<TD align="center">{!ROUND(subtotalAmericasMedQ1,0)}</TD>

 This is working on all my data, except for the number 10. Instead of diplaying "10" on the VF page, it displays "1E+1". 11 and 9 display correct, but for some reason the number 10 is changed to 1E+1. Has anyone else come across this error and have any tips I might be able to try to get it to actually display the number 10.

 

Thanks,

Mike

Hi,

I have got the id of the record type. But I dint know how to get the value(name) of the record type. Pls tell the the code to get the value of the record type.

 

Thanks 

anu

Alright, I have 3 objects set up.

A custom Pipeline Tracker object used to track certain deals

The standard Account Object

A custom Account Team object

 

Both my Pipeline Tracker and Account Team custom objects relate to the Account object on the Account Name.  I need to set up an SOQL statement pulling data from all the objects. About 90% will come from the Pipeline Object and only a handful of fields will come from the Account and Account Team objects.

 

As a test, I've been trying to call 3 fields. One field from each record.

I can successfully call "Category" from the Pipelline Tracker object, and I can successfully relate my Pipeline Tracker to the Account Object and pull the field "Sales Pole" from the Account Object. However, I'm stuck at how to then relate the Account object to my Account Team object and pull the field, "Sales Director". Does anyone know the proper syntax to successfully call a related record of a related record?

 

    List<Pipeline_Tracker_3__c> pipelineRecords = new List <Pipeline_Tracker_3__c>();

    public MultipleDBJoin()
    {
        buildList();
    }

    public void buildList()
    {
        for (Pipeline_Tracker_3__c pt: [SELECT Category__c, Account__r.Sales_Pole__c, Account__r.Account_Team__r.SD__c
        FROM Pipeline_Tracker_3__c])
        {
            pipelineRecords.add(pt);
        }
    }

 

Thanks,

Mike

 

Hello, I have a VF page where I want to use two groups of <Apex:Repeat> tags. One will call from a custom object, while the other will call from the Account object.  I want to display a couple of fields from each object, on the same row, but I am having trouble. Ideally, I want my  table to look like the following

 

Car Type      Car Make      Car Model      Account

Truck             Ford                F150               AAA

Car                Lotus              Elise               BBB

SUV               Toyota            Rav4               CCC

 

However, I am ending up with the following display instead:

 

Car Type      Car Make      Car Model      Account

Truck             Ford                F150              

Car                Lotus              Elise              

SUV               Toyota            Rav4

AAA

BBB

CCC              

 

Here's the code I have for this table.

  <TABLE border="1" cellpadding="2" cellspacing="2">
  <TH width="75">Category</TH>
  <TH width="100">Account</TH>
  <TH width="40">Engine Project</TH>
  <TH width="75">Engine Model</TH>
  <TH width="75">Region</TH>
  
 
  <apex:repeat value="{!opportunities}" var="a">       
       <TR><TD width="75"><apex:outputText value="{!a.Type__c}" /></TD>
       <TD width="100"><apex:outputField value="{!a.Make__c}" /></TD>
       <TD width="40">{!a.Model__c}</TD></TR>
  </apex:repeat>
  <apex:repeat value="{!accounts}" var="b">
      <TR><TD width="75"><apex:outputField value="{!b.Account__c}" /></TD></TR>
  </apex:repeat>
  </TABLE>

 

The <TR> tags seems to be where my problem lies. I tried having only 1 group of <TR> tags. I originally placed <TR> following the first <apex:repeat> and </TR> right before the last </apex:repeat>. However, I got an error saying that I needed to have a matching <TR> tags.

 

There's got to be a way to get my Account names to line up on the records as they should. I would appreciate any insight!

 

Thanks,

Mike

 

Hello, I have a custom Pipeline Tracker object I am using.. On each record, there is a relationship field that relates each Pipeline record to an Account record. What I want to do is gather fields from both my custom Pipeline Tracker Object and the standard Account table, using the Account Name as the join between the tables. However, I'm having trouble joining the tables.

 

Here's the SQL statement I have:

        for (Pipeline_Tracker__c pt: [SELECT p.Category__c, p.Account__c, a.Region__c 
        FROM Pipeline_Tracker__c p, Account a        
        WHERE  RecordType.Name =: channel AND p.Account__c = a.Name])
        {
           
            opportunities.add(pt);
        }

 

I get an error on the last part of the where statement, saying a.Name is not recognized. However, I feel like the error may be at the beginning where I say for (Pipeline_Tracker__c pt). Do I need to get the account object in there somehow? 

 

I would appreciate any help on the matter.

 

Thanks!

Mike 

Hello, I am trying to insert a variable into an SQL statement rather than having to hard code the SQL statement. Basically, I'm trying to build a list of cars made by a certain company.

 

I have tried two methods

 

In the first, I basically put the SQL statement into a string and concatenate the car company on the end. However, I think I need to include single quotes around the car company, but I wasn't sure how to do this since single quotes are used to open and close string variables. This method gave me an error, saying I needed to iterate my for loop over a collective item.

List<Cars__c> carList = new List <Cars__c>();


List<Cars__c> getcarList()
{
        make = ApexPages.currentPage().getParameters().get('carmake');
        sqlquery = '[SELECT Make__c, Model__c FROM Cars__c WHERE Make__c = ' + make + ']';
        
        for (Cars__c carrecord : sqlquery)
        {
            carList.add(carrecord); 
        }
 return carList;
}

 

My other method was to include the SQL within the for loop and see if I could just call the variable, make, but then I get an error saying that "make" is not recognized.

List<Cars__c> carList = new List <Cars__c>();


List<Cars__c> getcarList()
{
        make = ApexPages.currentPage().getParameters().get('carmake');
                
        for (Cars__c carrecord : [SELECT Make__c, Model__c FROM Cars__c WHERE Make__c = make])
        {
            carList.add(carrecord); 
        }
return carList;
}

 

Does anyone have any insight into how I can use my make variable within my SQL statement?

 

Thanks!

Mike

Hello, I am working on a test involving the passing of variables. Basically, a user is on a splash page where they input some values in an HTML form, which are then passed to my Apex page to be used as parameters in Java Functions.

 

I am new to this, so I've created a simple test. I set up a Splash Page where a user uses a dropdown to select the make of a car. Based on their selection, this parameter is passed to my Java-Interacting Apex Page.  So far, I got this part working as the parameter of my HTML form was in my URL:

http://a.salesforce.com/apex/CarSales?carmake=Ford

 

Now, this is where I"m getting stuck. I want to use my apex Page to send this variable to one of my Apex Classes where it will call a Java Function.

 

Here is the Apex Code I have from the web interface. carmake represents the variable that was passed from the previous HTML form.

<apex:page controller="Cars">
{!getMake(carmake)}
</apex:page>

 Here is my Cars Class

public class Cars
{

String make;
    
    public String getMake(String c)
    {
        if (c == 'Ford')
        {
             make = 'You have selected Ford';
        }

        else
        {
             make = 'You have not selected Ford';
        }

        return make;
    }
}

 

 

However, the variable carmake does not seem to be recognized, as I am getting the error:

Error: Unknown property 'Cars.carmake'

If anyone could provide any insight, I would really appreciate it.

Thank you,

Mike

First, let me apologize if this is a dumb question. I'm trying to reach back and pull my college Java courses, but I'm struggling.

 

Anyways, I have a public void method that I want to query a custom object, and depending on a field value, add each record to a certain list. I am doing this because I have multiple lists I will be calling from my VisualForce page, so I have the public void method to build the lists, and then functions to return those lists. However, when I call my lists, none of them are populated with data, so it seems my public voide method is not ran.

 

Here is the public void method:

public class MarginEscalators
{
List<Pipeline__c> marginEscalatorsComplete = new List <Pipeline__c>();
List<Pipeline__c> marginEscalatorsIncomplete = new List <Pipeline__c>();

public void buildLists()
{           
                         
        for (Pipeline__c me2011 : [SELECT      
                 ProjectID__C, Sales_Pole__c, Status__C
        FROM Pipeline__c          
        WHERE Year__c = 2011)
            {
                if (me2011.Status__c == 'Complete')
                {
                    marginEscalatorsComplete.add(me2011);    
                }                
                
                else if (me2011.Status__c == 'Incomplete')
                {
                    marginEscalatorsIncomplete.add(me2011);    
                }                 
                              
            }     
}     
     
    

 

 Here are my two simple functions:

public List<Pipeline__c> getMarginEscalatorsComplete()
{
    return marginEscalatorsComplete;
}

public List<Pipeline__c> getMarginEscalatorsIncomplete()
{
    return marginEscalatorsIncomplete;
}

 

 

I assumed that whenever I called either {!marginEscalatorsComplete} or {!marginEscalatorsIncomplete} on my VF page my public void method would be kicked off automatically. Is there something else I need to do in order to initiate the public void method?

 

The code below is how I've tried calling just one of my lists to see if my code worked, but it's not. I'm not getting errors, but I am getting a blank page.

<TABLE>
<apex:repeat value="{!marginEscalatorsComplete}" var="a">       
     <TR><TD width="75"><apex:outputText value="{!a.Subcategory__c}" /></TD>
         <TD width="100">{!a.ProjectID__c}</TD>
         <TD width="40">{!a.Sales_Pole__c}</TD>
         <TD width="75">{!a.Status__c}</TD></TR>
</apex:repeat>
</TABLE>

 

Again, I think it's because my public void method is not get initiated and building the lists, and I'm not sure how to make sure it is run. If anyone has any insight, I would greatly appreciate it.

 

Thanks,

Mike

Hello,

 

I was working on my visual force page with some Javascript. I noticed it wasn't triggering, so I made my code as simple as possible: to generate a popup as soon as the page loads. However, my code will not work. I copied my code into another one of my VisualForce pages, and it works there, but I cannot figure out why it won't work in this specific page.

 

<script language="javascript" type="text/javascript">
function hideEmptyRows()
{        
    alert('test');
}    
</script>
<body onLoad="hideEmptyRows()">

 I'm having trouble understanding why this would work on one VisualForce page, but not another.

Hello,

 

I have the following code which stores all of my my records for a given object into a custom list: totalRecords. I have a VF page that simply displays each record in this list.

 

public class ListView 
{

List<Pipeline_Tracker_Ver_2__c> totalrecords = new List <Pipeline_Tracker_Ver_2__c>();
Integer total;

    public List<Pipeline_Tracker_Ver_2__c> getTotalRecords()
    {            
                
        for (Pipeline_Tracker_Ver_2__c tr : [SELECT         
                 Sales_Pole__c,  Probability__c, Q1_Revenue__c,
        FROM Pipeline_Tracker_Ver_2__c          
        WHERE Year__c = '2011'])
            {                       
                total = total + tr.Q1_Revenue__c; 
                totalrecords.add(tr);                     
            }    
        
        return totalrecords;
    }

    public Integer getgrandTotal()
    {
        return total;
    }
    
}

 

 

Whenever I take out the variable, total, my list populates fine on my VF page. However, my statement:

totalrecords.add(tr); 

 seems to be causing problems. When I save my Apex Class, there are no errors, but when I try and load my VG page, I receive:

 

 

point System.NullPointerException: Attempt to de-reference a null object
Class.ListView.getTotalRecords: line 26, column 51 External entry point

 

 

Can anyone provide any insight into what I might be doing wrong. Am I calculating the total incorrectly since it seems to be finding a null value?

 

Thanks!

Mike

Hello, I followed the tutorials to create a VisualForce page that lists all the records on my object:

 

 

    public DisplayMarginEscalators[] getMarginEscalators()
    {
    
        if (marginescalatorsHigh == null)
        {
            marginescalatorsHigh = new DisplayMarginEscalatorsHigh[]{};
        
            for (Pipeline_Tracker__c pt : [SELECT Subcategory__c, Account__c,        
                 Sales_Pole__c, Probability__c, Q1_Revenue__c, SD_Owner__c,
FROM Pipeline_Tracker__c WHERE Year__c = 2011]) { marginescalators.add(new DisplayMarginEscalators(pt)); } } return marginescalators; }

 However, what I want to do is see if I can create another method that sets up a loop to go through my record collection and collect a total amount for the object: Q1_Revenue__c. I'm not sure how to do this, though.

I've been playing around with a for loop:

 

Integer x;
Integer total;
public Integer getTotal()
{
   for (x=0;x<marginescalators.size();x+1)
   {
       total = total + marginescalators[x].Q1_Revenue__c;
   }
}

 

But, I'm having trouble getting it working. Does anyone have any insight into how I can collect the running total for this amount? Please note, that I cannot use a SUM function because I have already used up my limit for SOQL queries.