Rule Navigation and prioritization using scripted rule

I have 3 Data rules with same request. In that request one array is there in that array if one value is USA I need to run 1 particular data rule. And if it is Japan, I need to perform another data rule. like that. If i am using "is" function it is affecting all other value in that array. I need to strict validation for value like USA/Japan/UK. In all data rule we have SCA calls as well.

  • Hello Clea,

    for array values, you may use matching using Compare Ordered or Compare Unordered functions. But both the 2 functions will be applied to all array items. You can't match individually by 1 array item. But if you create a scripted rule, you can edit your received request so that it resembles what you have in your data model. I would perhaps delete all array items in your request, except for the one item you want to use for matching, then I would delete the items in your data model rows where needed as well. 

    Example:

    You have an XML like

    <Books>

    <Book>A</Book>

    <Book>B</Book>

    <Book>C</Book>

    <Book>D</Book>

    </Books>

    And you are just interested in book C, in which case the array should match. So in your data model, you will remove all the array members except that one containing C, and you will also create a scripted rule that will remove array items that are not C, like e.g.:

    var b = sv.Request.Books.Book[2];           

    sv.Request.Books.Book[0] = b;

    sv.Request.Books.Book.RemoveAt(1);

    sv.Request.Books.Book.RemoveAt(1);

    sv.Request.Books.Book.RemoveAt(1);

    In this way whatever comes during the simulation in request you will alter it to look like the altered part of your data model and the data will match in case book C was in the request array.

    Regards

    Karel