Created
February 25, 2012 22:50
Revisions
-
snay2 renamed this gist
Feb 25, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
snay2 renamed this gist
Feb 25, 2012 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -36,11 +36,11 @@ // When the user clicks the Submit button on the form, save that value to // the entity variable map rule assign_key { select when web submit pre { val = event:param("val"); } notify("Maps", "I'm assigning the value '#{val}' to the key 'mykey' in the entity variable 'mymap'."); fired { set ent:mymap{"mykey"} val; } -
snay2 created this gist
Feb 25, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,72 @@ ruleset a163x153 { meta { name "Maps" description << Simple example of creating and using maps >> author "Steve Nay" logging off } dispatch { } global { } // A simple rule to fetch the value from an entity variable map // and allow the user to modify it. rule display_value { select when web pageview ".*" pre { val = ent:mymap{"mykey"}; msg = << The current value is #{val}.<br /> Set it here: <form id="myform"> <input name="val" /> <input type="submit" /> </form> >>; } { notify("Maps", msg) with sticky=true; watch("#myform", "submit"); } } // When the user clicks the Submit button on the form, save that value to // the entity variable map rule assign_key { select when web submit pre { val = event:param("val"); } notify("Maps", "I'm assigning the value '#{val}' to the key 'mykey' in the entity variable 'mymap'."); fired { set ent:mymap{"mykey"} val; } } /////////////////////////////////////////////////// // A simpler rule to demonstrate only getting. Test this and the following // rule by deploying this app and installing it your personal event network. // Then use the Kynetx Event Console to raise the value:fetch and value:store events. rule fetch_value { select when value fetch pre { val = ent:mymap{"mykey"}; } send_directive("text") with body="#{val}"; } // A simpler rule to demonstrate only setting rule set_value { select when value store pre { val = event:param("val"); } noop(); fired { set ent:mymap{"mykey"} val; } } }