+ Start a Discussion
TaddTadd 

Novice Needs Help With 2nd VF Page

I have a custom object with numerous record types. I am trying to creat a more print friendly page containing data from custom fields in the custom object. Here is what I have so far, I cannot get any of the data to show up in the table.

 

 

<apex:page standardController="Inventory__c" recordSetVar="Generator_Sets" sidebar="false" showHeader="false"> <apex:image value="https://na4.salesforce.com/servlet/servlet.ImageServer?id=01560000000MKsl&oid=00D6000000072B4&lastMod=1229623939000"/> <p></p> <apex:pageBlock title="Generator Sets" mode="detail"> <apex:pageBlockTable value="{!Inventory__c}"var="Generator_Sets" rules="rows" frame="none"> <apex:column value="{!Inventory__c.KW__c}"/> <apex:column value="{!Inventory__c.Engine_Brand__c}"/> <apex:column value="{!Inventory__c.Eng_Model__c}"/> <apex:column value="{!Inventory__c.Engine_Serial_No__c}"/> <apex:column value="{!Inventory__c.Condition__c}"/> <apex:column value="{!Inventory__c.Enclosure__c}"/> <apex:column value="{!Inventory__c.Additions__c}"/> <apex:column value="{!Inventory__c.Name}"/> <apex:column value="{!Inventory__c.Advertised_Price__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>

 Inventory is the custom object, generatot set is the record type and the column values are the custom fields.

 

Best Answer chosen by Admin (Salesforce Developers) 
jeffdonthemicjeffdonthemic

In your BlockTable the value attribute should be the collection returned by your controller

and the var attribute is the name of the current item in the iterator. Your code should look "something" like this:

 

 

<apex:pageBlockTable value="{!myCollection}" var="collectionItem" rules="rows" frame="none">
<apex:column value="{!collectionItem.KW__c}"/>
</apex:pageBlock>

 

I have an example of this at my blog that should help you out. Look at line 21 in the Visualforce page and the accompanying controller: http://blog.jeffdouglas.com/2009/05/08/inline-visualforce-pages-with-standard-page-layouts/

 

Good luck

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com

 

All Answers

jeffdonthemicjeffdonthemic

In your BlockTable the value attribute should be the collection returned by your controller

and the var attribute is the name of the current item in the iterator. Your code should look "something" like this:

 

 

<apex:pageBlockTable value="{!myCollection}" var="collectionItem" rules="rows" frame="none">
<apex:column value="{!collectionItem.KW__c}"/>
</apex:pageBlock>

 

I have an example of this at my blog that should help you out. Look at line 21 in the Visualforce page and the accompanying controller: http://blog.jeffdouglas.com/2009/05/08/inline-visualforce-pages-with-standard-page-layouts/

 

Good luck

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com

 

This was selected as the best answer
TaddTadd

Jeff,

 

Thanks for the help!

TaddTadd

Now that the page is working, I notice it is only returning 20 records, how do I get all of

the records to show?

jeffdonthemicjeffdonthemic

What does your SOQL query look like and how many records are in the database?

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com

MarkL.ax269MarkL.ax269
Sounds like you're using a list controller.  If so you'll get 20 records at a time and have to use pagination to get "Next" each time.
TaddTadd

Currently there are 127 records that should be showing in the list. I am not sure I even have a SOQL query. I have a custom view createdwithin SF and I am trying to use the same string from it's url for the VF page.

 

This is the url for the VF page: https://c.na4.visual.force.com/apex/inventory_list?id=00B60000005HjQZ and this is the SF page url: https://na4.salesforce.com/a0A?fcf=00B60000005HjQZ

jeffdonthemicjeffdonthemic

You might want to post your Visualforce code to make it easier.

 

If you are using the enhancedList component, there is an attribute that specifies the number of rows to return called "rowsPerPage". Try looking at the Visualforce docs for more info: Docs

 

Jeff Douglas

Informa Plc

http://blog.jeffdouglas.com