Is it possible to autoadd a node if i have a Generic template gathering a value i want to decide where the node should be put?
Ex i have template that check for program version "Templates->Generic->AppVersion"
If AppVersion >=1.0 add to node to "Templates->Generiv_v1"
If AppVersion >=2.0 add to node to "Templates->Generiv_v2"
It is possible to check DCI values in template autoapply scripts.
In the generic template, create a DCI that collects the application version.
In the autoapply script of the version-specific template use something like this. (Not tested, may contain errors)
sub main() {
ver = GetDCIValue($node, FindDCIByName($node, "AppVersion(theApp)"));
// nxsl finally uses short-circuit evaluation :-)
return (ver != NULL && $node->name ~= "node-name-regexp" && real(ver) > 1.2 && real(ver) < 2.0);
}
Thanks for the help.
I ended up with this AutomaticApplyRules that worked:
sub main() {
$ver = GetDCIValue($node, FindDCIByDescription($node, "AppVersionDescription"));
return ($ver != NULL &&
$node->name ~= "node-name-regexp" &&
real($ver) > 2);
}