formula in crs (ivr)

Answered Question
Sep 22nd, 2010
User Badges:

How to write next formula is easier:


if (p_value == -1 && type == "01" && status == "01" || p_value == -1 && type == "01" && status == "04" || p_value == -1 && type == "01" && status == "05" || p_value == -1 && type == "01" && status == "06" || p_value == -1 && type == "02" && status == "01" ..... )





Data:


type = 01, type = 02, type = 05, type = 06

status = 01, status = 04, status = 05, status = 06

Correct Answer by Aaron Harrison about 6 years 8 months ago

Hi


Not sure if this is 'easier', but it may be shorter. This will *probably* require a premium license, but I can't realy test that here.


Try this:


1) Add a boolean variable called 'testresult' or whatever

2) Add a 'set' step, and set testresult to this:

{
String[] acceptStatus = new String[] {"01","04","05","06"};  // Set up list of types that should return true
String[] acceptTest = new String[] {"01","02","05","06"}; // Set up list of status that should return true

if (java.util.Arrays.asList(acceptStatus).contains(status)
&& java.util.Arrays.asList(acceptTest).contains(type)
&& p_value  == -1){
  return true;
} else{
  return false;
}
}


3) You can then use 'testresult' as a test for the If step an do what you will under that.

Aaron


Please rate helpful posts....

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (1 ratings)
Loading.
Correct Answer
Aaron Harrison Wed, 09/22/2010 - 01:48
User Badges:
  • Super Bronze, 10000 points or more
  • Community Spotlight Award,

    Member's Choice, May 2015

Hi


Not sure if this is 'easier', but it may be shorter. This will *probably* require a premium license, but I can't realy test that here.


Try this:


1) Add a boolean variable called 'testresult' or whatever

2) Add a 'set' step, and set testresult to this:

{
String[] acceptStatus = new String[] {"01","04","05","06"};  // Set up list of types that should return true
String[] acceptTest = new String[] {"01","02","05","06"}; // Set up list of status that should return true

if (java.util.Arrays.asList(acceptStatus).contains(status)
&& java.util.Arrays.asList(acceptTest).contains(type)
&& p_value  == -1){
  return true;
} else{
  return false;
}
}


3) You can then use 'testresult' as a test for the If step an do what you will under that.

Aaron


Please rate helpful posts....

Actions

This Discussion