Hi i am writing a visual force whose code is
<apex:page id="pageId" controller="FieldSetDemonstration">
<apex:form id="formId">
<apex:pageblock id="pbId">
<apex:pageblocksection columns="1" id="pbsIs">
<apex:repeat value="{!Fields}" var="f">
<apex:outputLabel value="{!merch[f]}">
</apex:outputLabel></apex:repeat>
</apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>
and controller code is public class FieldSetDemonstration {
public Resource__c merch { get; set; }
public FieldSetDemonstration() {
this.merch = getMerchandise();
}
public List<Schema.FieldSetMember> getFields() {
return SObjectType.Resource__c.FieldSets.Hello2.getFields();
}
private Resource__c getMerchandise() {
String query = 'SELECT ';
for(Schema.FieldSetMember f : this.getFields()) {
query += f.getFieldPath() + ', ';
}
query += 'Id FROM Resource__c LIMIT 1';
System.debug('Hello world debug log');
Resource__c res= Database.query(query);
Object re=res.Resource_Position__r.Name;
System.debug('Hello World Debug log'+''+res); System.debug('Hello World1 '+query); return res; } }
and System Log values are
12:28:55.052 (52125000)|USER_DEBUG|[22]|DEBUG|Hello World Debug logResource__c:{Name=Hello Bro, OwnerId=00590000001V6loAAC, Id=a04900000023JI7AAM}
12:28:55.052 (52157000)|USER_DEBUG|[23]|DEBUG|Hello World1 SELECT Resource_Position__r.CreatedById, Resource_Position__c, Name, Owner.Email, Resource_Position_r.Name, Id FROM Resource_c LIMIT 1
and there is a master detail relationship between Resource__c and Resource_Position__c Hello2 in code is a fieldset which contain following fields
Resource Position > Resource Position Name
Resource Position
Resource Name
the problem i am facing instead of showing value of all three fields 1.Resource Position>Resource Position Name 2.Resource Position 3.Resource Name its showing value of only Resource Name no value for
Resource Position>Resource Position Name
Resource Position
but i associate a Resource_Position_c object with Resource_c object why its not showing the value of these two fields can any one please help in solving this problem.ur help is highly appreciable
if i add one more Field in fieldset hello2 Owner ID>E-mail then its showing correct email address of owner in visualforce page only problem is coming from this customobject's field name can any one please tell why its not giving value for Resource_Position__c.name fiels
System.debug(query))? That way you'll know whether it's a display issue or query has to be constructed in different way. - eyescream