简体   繁体   中英

KRL twitter search & app/entity variables available to all rules? (global)

I am wanting to build a Kynetx app that does a datasource query once and is available to all my rules in my ruleset/app. It would also be nice to do the same for app and entity variables. I'm not sure how to go about doing this and need some help. Do I write a rule that does the queries and then spits it out to the rest of the rules in some special way?

You can do datasource (and dataset ) queries in the global block of your application, and these variables will be available application wide.

global {
  datasource mydatasource <- "http://example.com/path/to/datasource";
  args = {"myvar":"myvalue"};
  results = datasource:mydatasource(args);
}

Keep in mind that this call is made in your global block, so you only have variables available in the global block. If your datasource depends on variables in a rule, you will to make the datasource query there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM