You need to sign in to do that
Don't have an account?

IF condition apex:repeat
Hello,
I have run into a problem with using IF conditions in apex:repeat.
I have various translated description fields that are referenced in the apex:repeat. If the field for the specific language (Japanese) is empty, the standard english language needs to be used.
This is my code:
<apex:repeat value="{!Quotelist2}" var="l2"> <tr style="font-size:80%;font-family:Arial Unicode MS;"> <td valign="top">{!IF(10 > cnt,"0","")}{!FLOOR(cnt)}</td> <td valign="top">{!l2.Item__r.Item_name__c}</td> <td valign="top">{!IF(l2.Item__r.Short_description_japanese__c = "",l2.Item__r.Short_description_english__c,l2.Item__r.Short_description_japanese__c)}</td> </tr> <apex:variable var="cnt" value="{!cnt+1}" /> </apex:repeat>
When saving it like this in Force.com IDE, I get "Save error: Unknown property: pdfData.l2"
pdfData is the name of the controller, but l2 should simply be the variable the apex:repeat provides, doesn't it?
What am I overlooking here?
Thanks in advance and Best Regards,
hoomel
This is so embarrasing ^^
The variable was not the problem (btw it was an l not a 1). Since I have split up the lists, I wanted to name the variables according to 1st and 2nd list.
But the problem was of much much simpler nature.
I had copied the IF clause from the l2-repeat to the l1-repeat (not shown here) and totally forgot to change the variable name there. The repeat variable was then l1 but I was trying to reference data from l2 o.O
Puja_mfsi just unintendedly put me on the right spot.
Thanks anyway for all the help, sorry to have wastes your time :D
All Answers
Can you provide your apex code?
I need to know about this list Quotelist2, What are the values present in side that list ?
For your reference go through this link
http://boards.developerforce.com/t5/Visualforce-Development/apex-repeat-and-apex-variable/td-p/661452
This should be all the relevant code:
In this case, list1 and list2 are filled depending on the length of the descriptions. If the lines that all descriptions would need on the PDF page, a second list is displayed on the second page.
I hope this gives enough insight.
Hi,
your code looks fine except the variable name which u have used for apex:repeat.
Why r u not taken variable name like "quote" or any other string,why u coose 12 as variable.
When I used "12' as a variable it gives error to me and if I replace this variable witha string it working fine.
Please repace "12" with any String.
Please let me know if u have any problem on same and if this post helps u give KUDOS by click on star at left.
This is so embarrasing ^^
The variable was not the problem (btw it was an l not a 1). Since I have split up the lists, I wanted to name the variables according to 1st and 2nd list.
But the problem was of much much simpler nature.
I had copied the IF clause from the l2-repeat to the l1-repeat (not shown here) and totally forgot to change the variable name there. The repeat variable was then l1 but I was trying to reference data from l2 o.O
Puja_mfsi just unintendedly put me on the right spot.
Thanks anyway for all the help, sorry to have wastes your time :D