KRL using a bee sting inside extended quotes

What are the actual expressions for bees in an extended quote?

rule set_persistents {
  select when pageview ".*"
  noop();
  always {
    ent:ecount += 1 from 1;
    app:acount += 1 from 1;
  }
}

rule test_bee_stings {
  select when pageview ".*"
  pre { 
    sum = ent:ecount + app:acount;
    content = <<
      sum is #{sum}<br/>
      sum + 1 is #{sum+1}<br/>
      ecount is #{ent:ecount}<br/>
      acount is #{app:acount}
    >>;
  }
  notify("Results", content) with sticky = true;
}

When I run this, I get nothing (I will never see the notification window). If I delete the ecount and acount lines, I get

sum is 2
sum + 1 is 21

What expressions for expressing bees act in an extended quotation? Isn't that the case with a regular quoted string?

+3
source share
1 answer

, , . , , . "sum + 1" , , JavaScript.

, :

ruleset a60x546 {
  meta {
    name "extended-quotes-beesting"
    description <<
      extended-quotes-beesting
    >>
    author "Mike Grace"
    logging on
  }

  rule test_bee_stings {
    select when pageview ".*"
    pre { 
      ecount = ent:ecount + 1;
      acount = app:acount + 1;
      sum = ecount + acount;
      sumplus = sum + 1;
      content = <<
        sum is #{sum}<br/>
        sum + 1 is #{sumplus}<br/>
        ecount is #{ecount}<br/>
        acount is #{acount}
      >>;
    }
    {
      notify("Results", content) with sticky = true;
    }
    always {
      ent:ecount += 1 from 1;
      app:acount += 1 from 1;
    }
  }
}

action- example.com : alt text

* , , , . , , , , , .

** should be taken with salt, as this is only one crazy opinion. :) *

+2
source

Source: https://habr.com/ru/post/1785970/


All Articles