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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With