Scripted Rules in HP SV (267 Views)
Reply
Advisor
prasan
Posts: 38
Registered: ‎07-29-2008
Message 1 of 3 (267 Views)

Scripted Rules in HP SV

Hi,

 

Can some please let me know how to use Scripted Rules in SV. And input functions are also very confusing, please let me know if any online support or documentation is available.

 

Regards

Prasan.

Occasional Advisor
Dave Flynn
Posts: 10
Registered: ‎09-03-2009
Message 2 of 3 (238 Views)

Re: Scripted Rules in HP SV

Scripted Rules are Javascript code which enables you to access the message structure directly and manipulate its values.  Before you get into the practice of scripting a rule, you should first rule out the ability to use the normal data model rules to achieve what you are looking to do. 

 

Even though this feature is new, too many people have jumped in scripting rather than thinking the problem through and leveraging the data model rules BEFORE starting to script.

 

On aspect that many new users fail to understand is how SV processes the rules.  The common (and mis-guided thought) is the rules are only processed from top to bottom and when it reaches the Default Rule, all processing is done.

 

This is not the case.

 

Let's take for example the most simple data model which has an empty Learned Rule and Default Rule (containing default responses).  Most people think that SV would pass through the rules only once but in reality, it passes through them twice.

First pass:

  • No match is found in Learned Rule
  • Match is made on the Default Rule

Since SV knows a rule was triggered, it will make a second pass to see if it can match on any rule that has NOT been triggered already.

 

Second pass:

  • Still no match is found in the Learned Rule
  • Default Rule has already been triggered so it is skipped

At this point, SV understands that no other possible changes could occur so it returns the values that were established when it executed the Default Rule and returns those values.

 

This type of processing enables you to create if/then conditions at the data level without ever having to engage in one line of code.  This is truly what "Data Driven" means and no other company has this capability.

 


Could you share a little bit more in what you are attempting to do with the scripting? 

 

Also, the objects that are accessible are noted in the comments section of the scripted rule.

 

Occasional Advisor
Dave Flynn
Posts: 10
Registered: ‎09-03-2009
Message 3 of 3 (178 Views)

Re: Scripted Rules in HP SV

UPDATE - new options for Scripted Rules

 

Right-click the scripted rule and select

Properties to display the options.

 

Skip the first simulation pass. To modify or complete data filled in by another rule, the

scripted rule must be have a higher priority than the rule you want to override. However, during

the first simulation pass, all the response data for the script has not yet been filled in by the

other rules. In this case, you may want to skip the scripted rule during the first simulation pass.

 

Execute the rule only once. As an example, you may be using the script to add an item into

an array, such as assigning an ID to a user. Each time the script is run, the rule will modify the

response, causing the simulation process to continue repeatedly. In this case, use this option

to properly execute the simulation.

 

This was all able to be done in the previous version as well through scripting but now this makes it easier.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.