03-02-2014 10:27 PM
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.
04-01-2014 02:43 PM
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.
- 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.
- 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.
06-26-2014 09:27 AM
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.
a week ago
I have a requirement to virtualize a service in which I want to sum up the values coming in request and send the same value in response.
Ex: Request is
so I want to send the response as
<Result>x+y</Result> // (where x and y value should be take in run time)
I have used below code
but I am getting error TypeError: undefined cannot be converted to an object
Can you provide me correct way to do it?