0

I got the following list of integer SelectOptions, and I want to add a String value to the SelectOption list. How can I convert String to Integer to add the String value?

'recordLimit' is an integer value I have declared in the controller.

Any help on this is appreciated.

<apex:pageBlockSectionItem rendered="{!isBuildReport}" >
                    <apex:outputLabel value="Record Limit" />
                    <apex:selectList value="{!recordLimit}" size="1" multiselect="false" >
                        <apex:selectOption itemValue="10" itemLabel="10" />
                        <apex:selectOption itemValue="50" itemLabel="50" />
                        <apex:selectOption itemValue="100" itemLabel="100" />
                        <!-- <apex:selectOption itemValue="All" itemLabel="All" /> -->
                    </apex:selectList>
                </apex:pageBlockSectionItem>

1 Answer 1

1

If in All, you want a sumatory of all values you can use that

<apex:pageBlockSectionItem rendered="{!isBuildReport}" >
                <apex:outputLabel value="Record Limit" />
                <apex:selectList value="{!recordLimit}" size="1" multiselect="false" >
                    <apex:selectOption itemValue="10" itemLabel="10" />
                    <apex:selectOption itemValue="50" itemLabel="50" />
                    <apex:selectOption itemValue="100" itemLabel="100" />
                    <!-- <apex:selectOption itemValue="160" itemLabel="All" /> -->
                </apex:selectList>
            </apex:pageBlockSectionItem>
4
  • What is different in your code?
    – BarCotter
    Mar 30, 2015 at 9:34
  • @BarCotter difference is he has given a itemValue to the String itemLabel
    – Tinkerbell
    Mar 30, 2015 at 9:39
  • The only difference I can see is that you changed itemValue="ALL" to itemValue="160" in the line that is commented out.
    – BarCotter
    Mar 30, 2015 at 9:46
  • Yes, I had the issue in that line so that's why it was commented out. Tried with Torsen's solution and it works fine !
    – Tinkerbell
    Mar 30, 2015 at 10:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .