+ Start a Discussion

Issue getting KnowledgeArticle data using Visualforce page and components

I have a Apex Class that looks like this:


global with sharing class Component_Query {
    global String queryString {
    global List results {
        get {
            List result = Database.Query(queryString);
            return result;
and a Apex Component that looks like this:
<apex:component controller="Component_Query" access="global">
  <apex:attribute name="QueryString" type="String" required="true" access="global" assignTo="{!queryString}"
    description="A valid SOQL query in string form." />
    <apex:variable value="{!results}" var="results"/>
    <apex:componentBody />
My Visualforce page looks like this:
<apex:page >
    <apex:pageblock title="Recommended KB Articles">
        <apex:outputPanel layout="block">
        <apex:stylesheet value="{!URLFOR($Resource.custom_table_template)}"/>
            <table id="articles">
            <th id="number">Article Number</th>
            <th id="title">Article Name</th>
            <th id="label">Article Type</th>
            <th id="date">Last Published Date</th>
            <th id="label">Article ID</th>
            <th id="label">Article ID</th>
            <th id="label">Parent ID</th>
            <knowledge:articleList articleVar="article" sortBy="mostViewed" pageSize="5">
                <td><a target="_parent" href="{!URLFOR($Action.KnowledgeArticle.View, article.id)}">{!article.title}</a></td>
                <apex:variable var="articleid" value="{!article.id}"/>
                <c:Query_component queryString="SELECT kavs.NormalizedScore, kavs.Id, kavs.ParentId FROM KnowledgeArticleViewStat kavs WHERE kavs.ParentId='{!articleid}'">
                    <apex:repeat value="{!results}" var="result">
When I render my page in a browser, it looks like this:
How come my "Parent ID" column doesn't match up witht he KnowledgeArticle Ids? Is my foreign key incorrect or something? How do I get the KnowledgeArticleViewStat that is associated with the KnowledgeArticle?