+ Start a Discussion
lnryanlnryan 

specify a SOQL query in value of apex:dataTable

At Dreamforce, I thought I saw an example in which a SOQL dataset was instantiated directly from within the value="..." element of an apex: container such as apex:dataTable, ie

Code:
<apex:pageBlockList var="myItem" value="!{[Select ID, Name From...]}">

but now that I'm searching for it I can't find anything like this. Is it possible? Is there some functionality like it that I may be confusing it with?

Thanks,
Lindsay

Ron HessRon Hess
wishful memory,
you still need a controller to execute that statement.

you can specify the list of related items when using standard controller. example if using account
then the following is a valid list to iterate over.

{!account.contacts}
{!account.Tasks}

etc..

Message Edited by dchasman on 05-14-2008 07:18 PM
asgirisoftasgirisoft
Ron,

I have a client who wants all entries (created in the previous month) of a custom object displayed as a PDF. They have Professional edition only, which means that I cannot write a query (for records of the previous month only) on a custom controller extension. Is there any way to query from a Visualforce tag such as datatable?

Andi Giri
lnryanlnryan

Does professional edition still have VF? (we have unlimited so i'm not so familiar...)

If so, you could probably do the following without needing Apex Code:

 

- Create a List view for the Custom Object

- Follow the documentation provided in the VF Dev Guide for refreshing a data table based on an existing List View

- Use either fieldsets or explicitely defined fields in your data table (field sets would give your client better flexibility in the long run)

- Include a render as PDF button for after the list view is selected

 

 

I haven't looked into how to pre-define which list view to use, but you could probably figure it out by lifting the ID from the standard list view page's querystring parameters or by dumping the list view variable into an apex:outputText tag.