You need to sign in to do that
Don't have an account?
rebvijkum
Error: Unknown property 'String.DataCategoryName'
I don't know where i'm doing wrong
My Page:
<apex:page standardController="Core_Benefit__kav" extensions="GetURL" id="corebenefitpageid" applyBodyTag="false" sidebar="false" showHeader="true" >
<apex:outputText id="categoryname" value="{!Category.DataCategoryName}"/>
</apex:page>
My Controller:
public class GetURL {
public GetURL(ApexPages.KnowledgeArticleVersionStandardController controller) {
filterid=[SELECT Id FROM Core_Benefit__kav WHERE ArticleNumber = '{!Core_Benefit__kav.ArticleNumber}' AND PublishStatus = 'online' AND Language = 'en_US'].Id;
CatDetails= [Select DataCategoryName,DataCategoryGroupName from Core_Benefit__DataCategorySelection where ParentId =:'filterid'].DataCategoryName;
}
public string CatDetails;
public string filterid;
public string getCategory() {
return CatDetails;
}
}
My Page:
<apex:page standardController="Core_Benefit__kav" extensions="GetURL" id="corebenefitpageid" applyBodyTag="false" sidebar="false" showHeader="true" >
<apex:outputText id="categoryname" value="{!Category.DataCategoryName}"/>
</apex:page>
My Controller:
public class GetURL {
public GetURL(ApexPages.KnowledgeArticleVersionStandardController controller) {
filterid=[SELECT Id FROM Core_Benefit__kav WHERE ArticleNumber = '{!Core_Benefit__kav.ArticleNumber}' AND PublishStatus = 'online' AND Language = 'en_US'].Id;
CatDetails= [Select DataCategoryName,DataCategoryGroupName from Core_Benefit__DataCategorySelection where ParentId =:'filterid'].DataCategoryName;
}
public string CatDetails;
public string filterid;
public string getCategory() {
return CatDetails;
}
}
Use above code to display those fields on V.F page
All Answers
CatDetails= [Select DataCategoryName,DataCategoryGroupName from Core_Benefit__DataCategorySelection where ParentId =:'filterid'].DataCategoryName;
which will returns a String i.e DataCategoryName for a record.
and on you page you again trying to fetch DataCategoryName from a String.
<apex:outputText id="categoryname" value="{!Category.DataCategoryName}"/>
so to remove this error replace <apex:outputText id="categoryname" value="{!Category.DataCategoryName}"/> with <apex:outputText id="categoryname" value="{!Category}"/> it will solve your problem.
so i'm retrieving two field values i.e.,DataCategoryName and DataCategoryGroupName from Core_Benefit__DataCategorySelection object.
so how to display these values in visualforce page, without using .Datacategoryname at the end of second soqlquery???
Use above code to display those fields on V.F page