Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 205
  • Last Modified:

List all articles from a specific article_category

I need to list all articles from a specific article category

This code only lists one article, the tables are one-to many, one article category can hav many articles, but one article can only have one category

class clsListArtikler : INTPageBlock
//---------------------------------------------------------------------------------
{
  //............................................................................
  public override Table Run ( )
  //............................................................................
  {
    Table oTable  = new Table();

    TableRow oRow = new TableRow ();
    TableCell oCell = new TableCell ();
    oRow.Cells.Add (oCell);
    oTable.Rows.Add (oRow);
    string sHTML  = "";

    KL_Artikkel_All_fields oView = new KL_Artikkel_All_fields ();
    oView.AddSelection ("id=" + INTPage.GetParamInt(m_sParamName));

    if ((oView.Open()) && (oView.Next()))
    {

      sHTML += m_oLook.FormatHeader1(oView.Heading) +
            m_oLook.FormatBodytext(oView.Broedtekst) ;
      oView.Close();

    }

    oCell.Text = sHTML;
   
    return oTable;
  }
}
0
lenmor
Asked:
lenmor
1 Solution
 
AgariciCommented:
i did not understood very well your code, but to list all articles of a category you should create a ralation "Category_Article"
with the parent the IDCat from ArticleCategoryTable and child whatever column contains the id of the categry in ArticlesTable

then, to obtain all the articles of a given category (let say a category with idCat == SomeCatID ), you would do:


DataRow[] drv = ArticleCategoryTable.Select( string.format( "IDCat = {0}", SomeCatID ) );
if( drv.Length == 1 )
  return drv[0].GetChildRows( "Category_Article" );


hth,
A.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now