Macro in transformation can count number of field page type

web dev asked on February 1, 2019 12:12

after posting this question i didnt find any macro can do this function it think i should develope a custom methode to count the number of categoryItem come from page type (cms.news) any idea thanks

Saving :3

money: 5

Sport:10

Correct Answer

web dev answered on February 1, 2019 13:47

hello freinds i find custom code here is it

<script runat="server"> protected override void OnInit(EventArgs e)
{   
  base.OnInit(e); 
  var cat = ValidationHelper.GetString(Eval("NewsCategory"), string.Empty);
  var ds = new CMS.DataEngine.DataQuery("AT.SCUNews.selectall")
      .Where("NewsCategory", CMS.DataEngine.QueryOperator.Like, cat)
      .Execute();
  litCount.Text = ds.Tables[0].Rows.Count.ToString();
}</script>
1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on February 1, 2019 15:31

You should post what your custom query is becuase that is where all the "magic" is happening.

Also refer to your other post for the exact same thing. Next time, post your response there vs. creating a new post for the same exact thing.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.