Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: make io.picolabs.collection system ruleset

...

The complete code for this ruleset can be found at https://raw.githubusercontent.com/Picolab/pico_lessons-engine/master/collections/edu.byu.enMotion/packages/pico-engine/krl/io.picolabs.collection.krl

Creating a collection pico

...

Code Block
linenumberstrue
  rule collection_needed {
    select when grouper creation
    pre {
      name_prefix = event:attr("name_prefix");
      group_name = name_prefix + " Rooms";
      rids = "eduio.byupicolabs.enMotion.collection;io.picolabs.subscription";
      child_specs = { "name": group_name, "name_prefix": name_prefix,
        "rids": rids, "color": "#002e5d" };
    }
    fired {
      raise wrangler event "new_child_request" attributes child_specs;
    }
  }

...

Code Block
linenumberstrue
  meta {
    use module eduio.byu.enMotionpicolabs.collection alias collection
    shares some_function
  }
  global {
    some_function = function() {
      collection:members()// some further processing
    }
  }
  rule some_rule {
    select when something required
    foreach collection:members() setting(subs)
    // some action/postludes for each subs
  }

...