質問

How do I get the name of the current ruleset in a KRL rule? I find that I often write

notify("a421x70","Your Message Here") with sticky = true;

but when I copy the ruleset I have to go through and change the "a421x70" part. It would be so much better to have the current ruleset in a variable and use that in my notify() action.

役に立ちましたか?

解決

In the pre block of a rule you can

rid = meta:rid();

http://docs.kynetx.com/docs/Meta_Info

Example:

enter image description here

ruleset a60x598 {
    meta {
        name "appid tester"
        description <<
            getting app rid pragmatically 
        >>
        author "Michael Grace"
        logging off
    }

    rule get_rid_rule {
        select when web pageview ".*"
        pre {
            rid = meta:rid();
        }
        {
            notify("Current App rid is", "#{rid}") with sticky = true;
        }
    }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top