You need to sign in to do that
Don't have an account?
conditionally render info with VF page or rendered PDF -- existing logic was php
Hi, within a VF page or PDF rendering, I need to replace/mimic php code used to evaluate some field(s) value and then display 'sections' of HTML / PDF accordingly. Browsing other messages in the boards I am fairly certain I can do this with an IF formula and outputText or a table with conditional row rendering. I am a certified adv. admin (successfully) plundering my way through the conversion of existing HTML for PDF rendering into VF email templates/attachments and PDFs ... until I hit the php code.
I need some help defining:
1 - an approach to take. Can I use multiple apex:outputText within one part of the IF formula? Or should I create separate VF pages to hold the content needed in each condition and pull it into the page with <apex:insert> and <apex:composition>? Or ...?
2 - if it is (easily) possible to replace the "num2words" conversion done in php -- ($0.20 is presented as "Twenty cents")?
The page/PDF is a 'contract' template with a few merge fields inserted. Within section '3', sub-sections, each nicely indented, the logic is:
IF "currency1__c "> 0 then display sub-sections a,b,c,d and specific sections 5, 6 and 7 --- 'a' contains one merge field.
IF "fieldXYZ__c='abc' then display, within section 3, alternate sub-sections a,b,c,d, & e and "alternate" sections 5, and 7 -- with sub-section 'e' a variable defined for showing 2 increasing iterations of ('currency1__c' * 0.5).
ELSE -- show the same section 4 and 6, and the "original" sections 5 and 7.
-------
I could provide the existing php if my summary is unclear or incomplete. The content ends up in PDFs only - not a page in a browser.
Thanks for any help provided here. I am open to someone else solving this for a fee ...
jayster4x
It is possible to do everthing that you imagine...
You can read how to render a VF page as a PDF in the browser, the browser may have a pdf plugin or may forward the file to your pdf reader, from where you could save or print it.
http://salesforcesource.blogspot.com/2009/04/how-to-create-word-pdf-or-excel-files.html
the apex:Page tag also has a contentType="" attribute you could set.
see page 43, 242, 341:
http://www.salesforce.com/us/developer/docs/pages/salesforce_pages_developers_guide.pdf
The following lists which VF tags are safe for PDF use, though you could just see what works for you.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_additional_render_pdf.htm
By using the apex:outputText tag and it's rendered="" attribute (with an expression) you can conditionally output text onto the page depending on various field values.
The above illustrates how you can conditionally render a whole block of text, and then within that text you can have merge fields and even variable text.
You might try googling for a salesforce way of converting numbers to words, but I expect it will involve some apex code.