You need to sign in to do that
Don't have an account?
MMA_FORCE
For Loop Please...
HI:
I have a variable Public String Terms;
I have about 4 Terms to a grade. So 9.1, 9.2, 9.3,9.4 and then 10.1, 10.2, 10.3 etc until 12th grade.
I wrote this for loop because I need to render outpanels by the Term
for(Integer z=1;z<5;z++){ for(Integer ii=9;ii<13;ii++){ Terms = Terms+ii+'.'+z; System.Debug('zTerms ' + Terms ); } }
Of course I do not know if this is correct I do see the debug doing it:
9.110.111.112.19.210.211.212.29.310.311.312.39.410.411.412.4
But I need to break it for each Term...
So in my VF Page I can say:
<apex:outputPanel rendered="{!Terms='9.2'}">
Is this correct?
Thanks
Is there any particular reason why you require a wrapper class? A list of strings would do the trick, as follows:
public List<String> getGrades()
{
List<String>grades=new List<String>();
for(Integer z=1;z<5;z++)
{
for(Integer ii=9;ii<13;ii++)
{
grades.add(ii+'.'+z);
}
}
System.Debug('grades ' + grades );
return grades;
}
I've used this in a page as follows:
<apex:repeat value="{!grades}" var="grade">
<apex:outputText value="Special {!grade}" rendered="{!grade=='9.4'}"/>
<apex:outputText value="{!grade}" rendered="{!NOT(grade=='9.4')}"/>
<br/>
</apex:repeat>
And I get the following results:
9.1
10.1
11.1
12.1
9.2
10.2
11.2
12.2
9.3
10.3
11.3
12.3
Special 9.4
10.4
11.4
12.4
All Answers
First of all i would change the order of the for anidation, so it gets ordered by the integer part of the term
Apart from that it is doing what you want, just add a space on system.debug end to separate each term from another
Thank you for the quick response... hmm How do I add a space in the System Debug... But in my VF Page:
This does not work:
<apex:outputPanel rendered="{!Terms='9.1'}">
??
Like how would I separate it to call it in my VF Page?
Do this to add an space to the output:
System.debug(Terms + ' ');
The thing is as you are doing it right now Terms will always end up with the same value which is 12.4 i guess
I think you'll need an List of String to do what you want
Ok So I changed it and placed it in a wrapper class...
Termsx = new List<ARHolderT>(); for(Integer ii=9;ii<13;ii++){ for(Integer z=1;z<5;z++){ ARHolderT myObject = new ARHolderT(); myObject.Terms = myObject.Terms+ii+'.'+z; System.Debug('zzterm ' + myObject.Terms); Termsx.add(myObject); } }
Now... In my VF Page I did:
<apex:variable value="{!Termsx}" var="h"/> <apex:outputPanel rendered="{!h.Terms='9.1'}">
I get this error:
Unknown property 'VisualforceArrayList.Terms'????
Thanks
I do appricate all your help... Can you give me an example of it because I tried this and it did not work:
<apex:variable value="{!Termsx}" var="h"/> <apex:outputPanel rendered="{!h}"> OR <apex:variable value="{!Termsx}" var="h"/> <apex:outputPanel rendered="{!h}='9.1'">
Is there any particular reason why you require a wrapper class? A list of strings would do the trick, as follows:
public List<String> getGrades()
{
List<String>grades=new List<String>();
for(Integer z=1;z<5;z++)
{
for(Integer ii=9;ii<13;ii++)
{
grades.add(ii+'.'+z);
}
}
System.Debug('grades ' + grades );
return grades;
}
I've used this in a page as follows:
<apex:repeat value="{!grades}" var="grade">
<apex:outputText value="Special {!grade}" rendered="{!grade=='9.4'}"/>
<apex:outputText value="{!grade}" rendered="{!NOT(grade=='9.4')}"/>
<br/>
</apex:repeat>
And I get the following results:
9.1
10.1
11.1
12.1
9.2
10.2
11.2
12.2
9.3
10.3
11.3
12.3
Special 9.4
10.4
11.4
12.4