• Every page should have a page counter to say how many times the page has been viewed.

    By Christian Brandlehner 2 decades ago
    • Every page should have a page counter to say how many times the page has been viewed.

      By Christian Brandlehner 2 decades ago
    • Re: counter

      By Christian Brandlehner 2 decades ago

      Ray sent me an email with the following code for a field:



      profilename := "Page Usage Count";

      docid := @Text(@DocumentUniqueID);

      timestamp := @Now;

      count := @GetProfileField(profilename; "Count"+docid);

      @If(count="";

      @Do(@Set(&quot;count&quot;;1); @SetProfileField(profilename; &quot;TimeStamp&quot;+docid; timestamp)); <br/>
      @Do(@Set(&quot;timestamp&quot;;@GetProfileField(profilename; &quot;TimeStamp&quot;+docid)); @Set(&quot;count&quot;; count+1))); <br/>
      

      @SetProfileField(profilename; "Count"+docid; count);

      "This page has been accessed " + @Text(count) + " times since " + @Text(timestamp; "D0T1S2")

      • hmm, some thoughts

        By Christian Brandlehner 2 decades ago

        The code does not fit my security model as the users needs to have write access to the database to increase the counter. I will keep trying to find a solution for this request.



        Christian