2

I'm trying to explore my options for rotating a VF table by mimicing the following post:

http://bobbuzzard.blogspot.com/2010/09/rotating-visualforce-table.html

However near the bottom I'm having trouble getting the rows[1].addValue... to compile. They all come back with the following error:

classes/FinancialOrdersWrapper.cls: Method does not exist or incorrect signature: void addValue(Decimal) from the type FinancialOrdersWrapper.RowWrapper (Line: 54, Column: 22)

I should note that the page complies with the lines commented out and even the vf page displays as I want. However it isn't showing what I want (the final 17 fields...)

public with sharing class FinancialOrdersWrapper {

    public Class RowWrapper{
         public List<String> values {get; set;}
        public RowWrapper(){
           values=new List<String>();
        }
        public void addValue(String value)
        {
            values.add(value);
        }
    }
     public List<Financial_Orders_Data__c> getFinancialOrders()
    {
        if (null==fods)
        {
            fods=[SELECT Id, Name, ECD_Award_Count__c, ECD_Loss_Count__c, ECD_Losses_Dropped__c, ECD_Losses__c, ECD_Month_Win_Rate_2__c, ECD_Month_Win_Rate__c, ECD_Orders_2__c, ECD_Orders__c, ECD_Proposal_Avg__c, ECD_Proposals_2__c, ECD_Proposals__c, ECD_Signed_excluding_CO_s_2__c, ECD_Signed_excluding_CO_s__c, ECD_YTD_Win_Rate_2__c, ECD_YTD_Win_Rate__c, Month_Win_Rate__c, YTD_Win_Rate__c, First_Day_of_Month__c from Financial_Orders_Data__c order by First_Day_of_Month__c ASC];
        }

        return fods;
    }
    private List<Financial_Orders_Data__c> fods;
    private List<RowWrapper> rows;
    private RowWrapper headings;
     public RowWrapper getHeadWrap()
    {

        if (null==headings)
        {
            headings=new RowWrapper();
            for (Integer idx=1; idx<=getFinancialOrders().size(); idx++)
            {
                headings.addValue('Financial_Orders_Data__c ' + idx);
            }
        }

        return headings;
    }
     public List<RowWrapper> getRowWrappers()
    {
        if (null==rows)
        {
            rows=new List<RowWrapper>();


            for (Integer idx=0; idx<11; idx++)
            {
                rows.add(new RowWrapper());
            }

            for (Integer idx=0; idx<getFinancialOrders().size(); idx++)
            {
                rows[0].addValue(getFinancialOrders()[idx].Name);

                //the following all break...
                /*
                rows[1].addValue(getFinancialOrders()[idx].ECD_Orders__c);
                rows[2].addValue(getFinancialOrders()[idx].ECD_Signed_excluding_CO_s__c);
                rows[3].addValue(getFinancialOrders()[idx].ECD_Losses__c);
                rows[4].addValue(getFinancialOrders()[idx].ECD_Month_Win_Rate__c);
                rows[5].addValue(getFinancialOrders()[idx].ECD_YTD_Win_Rate__c);
                rows[6].addValue(getFinancialOrders()[idx].ECD_Award_Count__c);
                rows[7].addValue(getFinancialOrders()[idx].ECD_Loss_Count__c);
                rows[8].addValue(getFinancialOrders()[idx].Month_Win_Rate__c);
                rows[9].addValue(getFinancialOrders()[idx].YTD_Win_Rate__c);
                rows[10].addValue(getFinancialOrders()[idx].ECD_Orders_2__c);
                rows[11].addValue(getFinancialOrders()[idx].ECD_Signed_excluding_CO_s_2__c);
                rows[13].addValue(getFinancialOrders()[idx].ECD_Losses_Dropped__c);
                rows[14].addValue(getFinancialOrders()[idx].ECD_Month_Win_Rate_2__c);
                rows[15].addValue(getFinancialOrders()[idx].ECD_YTD_Win_Rate_2__c);
                rows[16].addValue(getFinancialOrders()[idx].ECD_Proposals__c);
                rows[17].addValue(getFinancialOrders()[idx].ECD_Proposals_2__c);
                rows[18].addValue(getFinancialOrders()[idx].ECD_Proposal_Avg__c);
                */
            }
        }

        return rows;
    }
}

Any thoughts? Bob's example seems to work just fine for me...

1

The RowWrapper class has a method addValue() that takes String as the parameter .

Looks like in this line of code rows[1].addValue(getFinancialOrders()[idx].ECD_Orders__c);

ECD_Orders__c is a field of type Decimal and hence easiest way would be to convert Decimal to String use toPlainString() method of Decimal Class .

Like below code

rows[1].addValue((getFinancialOrders()[idx].ECD_Orders__c).toPlainString());

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.