You need to sign in to do that
Don't have an account?
mat_tone_84
problem with function IF - vf render as pdf
Hi,
I want create a custom vf page with this code, but I get syntax error.
I read the help of SF but I didn't find the answer of my problem :(
<apex:page renderAs="pdf" standardController="opportunity"> <html><head> {!if(isblank(opportunity.custom1__c),'true',{!opportunity.custom2__c})} {!if(isblank(opportunity.custom1__c),'true',<apex:outputText value="{!opportunity.custom2__c}"/>)} {!if(isblank(opportunity.custom1__c),'true',<apex:outputText value="'"/>)} {!if(isblank(opportunity.custom1__c),'true',<br/>)} </head> <body> </body> </html> </apex:page>
all 4 IF doesn't work,
2nd ,3th and 4th I get syntax error. ""<""
1st I get syntax error
I have to create a custom pdf with custom phrases by checking the value of "opportunity.custom1__c"
thanks
perfect, this works properly for line break
Now I try to substitute '<br/>' with ''' and I get "EL Expression Unbalanced"
All Answers
I don't think we can use <> tags in IF condition so I have changed your code a bit so you can have some direction how you can solve your problem. Hope this will help you.
Hi,
thanks!
with your post I solve 1st and 2nd.
And for 3th ( ' ) and 4th (<br>, line break) problem, how can I solve it?
thanks
Change it like this
Sorry I missed the two :
Hope this will help.
with your code I have the output:
\' and <br/>
I don't want this, but I want only ' and line break because is an html page...
Try this
1st and 2nd works properly but the 3rd and 4th give me this output: \' <br/>.
The page is html and I need only ' and line break
thanks
Have you tried the latest solution provided by me??
perfect, this works properly for line break
Now I try to substitute '<br/>' with ''' and I get "EL Expression Unbalanced"
So is your problem is resolved ???
for <br> is ok
the last problem is how to write this in if condition:
<apex:outputLabel value="'"/>
I don't think we can write this is If condition on page. Rather you can do this :
Hi, I have seen the previous post which you posted about if conditions. Please help me.
My requirement is displaying the pdf through visual force page with out using controller. If we pass the type=pdf want to render as pdf. otherwise it will display in normal page format. For this i used the below code. In if statement i got the syntax error. Please any one help me out.
In first line i used the if statement. I got the error as 'Syntax Error'. Please help me out
My vf page code:
<apex:page standardController="Employee__c" renderAs="{!IF({!$CurrentPage.parameters.type}=='pdf',pdf,null)}">
<html>
<head>
<style type="text/css">
.headertab
{
font_weight:bold;
color:#FFFFFF;
width:150px;
height:30px;
margin:auto;
background:#008B8B;
background-repeat:repeat-x;
}
.tdgeneral
{
border-bottom:1px solid #00A0BA;
text-align=center;
height:35px;
}
.blogposts img {
margin: 0;
padding: 10px;
background: transparent ;
color: #464219;
border: 1px solid #B6B500;
}
body {
color:#BDE3EF;
text-align=center;
background-color:transparent;
font-family:arial;
font-size:12pt;
color:black;
text-decoration:none;
}
input.btn {
color:#111;
font: bold 84% 'verdhana',helvetica,sans-serif;
background-color:#efe;
border: 2px solid;
border-color: #996 #663 #333 #999;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=5,StartColorStr='#ffffffff',EndColorStr='#ffeeddaa');
}
</style>
</head>
<body>
<apex:form >
<apex:outputText value="{!$CurrentPage.parameters.type}"></apex:outputText>
<table cellspacing="0" cellpadding="0" border="0" align="center">
<tr><th class="headertab">Employee Details</th>
<th class="headertab">Values</th></tr>
<tr><td class="tdgeneral">Employee Name</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.name}"/></td></tr>
<tr><td class="tdgeneral">Access Location</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Access_Location__c}"/></td></tr>
<tr><td class="tdgeneral">Access Teams</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Access_Teams__c}"/></td></tr>
<tr><td class="tdgeneral">Current Business SME</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Current_Business_SME__c}"/></td></tr>
<tr><td class="tdgeneral">Current Product Operator</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Current_Product_Operator__c}"/></td></tr>
<tr><td class="tdgeneral">Test</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Test__c}"/></td></tr>
<tr><td class="tdgeneral">Id</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Id__c}"/></td></tr>
<tr><td class="tdgeneral">Dept Id</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Dept_ID__c}"/></td></tr>
<tr><td class="tdgeneral">Dept Desc</td><td class="tdgeneral"> <apex:outputText value="{!Employee__c.Dept_Desc__c}"/></td></tr>
</table>
</apex:form>
</body>
</html>
</apex:page>
Thanks,
Lakshmi