Here is the error I am receiving:
When I try to run this code:Error in roll for IF option. Statement options (if any): h, IF(response == 0), CODE Statement Body (first 200 characters): { [h, FOREACH(food, foodArray), CODE: { [h: foodGroup = json.get(food,"group")] [h, IF(foodGroup == "Fruit"), CODE: { [h: fruit
Code: Select all
<!-- Check to see if they are sure --->
[h: warnText = "<html><FONT COLOR = red><b>Scary warning message!<BR>You should read this!</b></FONT></html>"]
[h: respList = "Yes,No"]
[h: success = input(
"junkVar||"+ warnText +"|LABEL|TEXT=FALSE",
"response |"+ respList +"| Are you sure you want to continue?| RADIO| ORIENT=H"
)]
[h: abort(success)]
<!-- Create an JSON array to play with -->
[h: foodArray = "[]"]
[h: fruitArray = "[]"]
[h: meatArray = "[]"]
[h: newFood1 = json.set("","ID",1,"group","Fruit","name","Apple")]
[h: newFood2 = json.set("","ID",2,"group","Fruit","name","Banana")]
[h: newFood3 = json.set("","ID",3,"group","Fruit","name","Kumkwat")]
[h: newFood4 = json.set("","ID",4,"group","Meat","name","Beef")]
[h: newFood5 = json.set("","ID",5,"group","Meat","name","Pork")]
[h: foodArray = json.append(foodArray,newFood1)]
[h: foodArray = json.append(foodArray,newFood2)]
[h: foodArray = json.append(foodArray,newFood3)]
[h: foodArray = json.append(foodArray,newFood4)]
[h: foodArray = json.append(foodArray,newFood5)]
<!-- Use the input to determine code to run -->
[h, IF(response == 0), CODE:
{
<!-- Seperate the good groups -->
[h, FOREACH(food, foodArray), CODE:
{
[h: foodGroup = json.get(food,"group")]
[h, IF(foodGroup == "Fruit"), CODE:
{
[h: fruitArray = json.append(fruitArray,food)]
}]
[h, IF(foodGroup == "Meat"), CODE:
{
[h: meatArray = json.append(meatArray,food)]
}]
}]
[h: output = "Meat: "+ meatArray +"<BR>Fruit: "+ fruitArray]
};
{
[h: output = "User aborted process"]
}]
<!-- Output results -->
[r: output]
Code: Select all
<!-- Check to see if they are sure --->
[h: warnText = "<html><FONT COLOR = red><b>Scary warning message!<BR>You should read this!</b></FONT></html>"]
[h: respList = "Yes,No"]
[h: success = input(
"junkVar||"+ warnText +"|LABEL|TEXT=FALSE",
"response |"+ respList +"| Are you sure you want to continue?| RADIO| ORIENT=H"
)]
[h: abort(success)]
<!-- Create an JSON array to play with -->
[h: foodArray = "[]"]
[h: fruitArray = "[]"]
[h: meatArray = "[]"]
[h: newFood1 = json.set("","ID",1,"group","Fruit","name","Apple")]
[h: newFood2 = json.set("","ID",2,"group","Fruit","name","Banana")]
[h: newFood3 = json.set("","ID",3,"group","Fruit","name","Kumkwat")]
[h: newFood4 = json.set("","ID",4,"group","Meat","name","Beef")]
[h: newFood5 = json.set("","ID",5,"group","Meat","name","Pork")]
[h: foodArray = json.append(foodArray,newFood1)]
[h: foodArray = json.append(foodArray,newFood2)]
[h: foodArray = json.append(foodArray,newFood3)]
[h: foodArray = json.append(foodArray,newFood4)]
[h: foodArray = json.append(foodArray,newFood5)]
<!-- Removed branching statement -->
<!-- Seperate the good groups -->
[h, FOREACH(food, foodArray), CODE:
{
[h: foodGroup = json.get(food,"group")]
[h, IF(foodGroup == "Fruit"), CODE:
{
[h: fruitArray = json.append(fruitArray,food)]
}]
[h, IF(foodGroup == "Meat"), CODE:
{
[h: meatArray = json.append(meatArray,food)]
}]
}]
[h: output = "Meat: "+ meatArray +"<BR>Fruit: "+ fruitArray]
<!-- Removed branching statement -->
<!-- Output results -->
[r: output]
Code: Select all
<!-- Check to see if they are sure --->
[h: warnText = "<html><FONT COLOR = red><b>Scary warning message!<BR>You should read this!</b></FONT></html>"]
[h: respList = "Yes,No"]
[h: success = input(
"junkVar||"+ warnText +"|LABEL|TEXT=FALSE",
"response |"+ respList +"| Are you sure you want to continue?| RADIO| ORIENT=H"
)]
[h: abort(success)]
<!-- Create an JSON array to play with -->
[h: foodArray = "[]"]
[h: fruitArray = "[]"]
[h: meatArray = "[]"]
[h: newFood1 = json.set("","ID",1,"group","Fruit","name","Apple")]
[h: newFood2 = json.set("","ID",2,"group","Fruit","name","Banana")]
[h: newFood3 = json.set("","ID",3,"group","Fruit","name","Kumkwat")]
[h: newFood4 = json.set("","ID",4,"group","Meat","name","Beef")]
[h: newFood5 = json.set("","ID",5,"group","Meat","name","Pork")]
[h: foodArray = json.append(foodArray,newFood1)]
[h: foodArray = json.append(foodArray,newFood2)]
[h: foodArray = json.append(foodArray,newFood3)]
[h: foodArray = json.append(foodArray,newFood4)]
[h: foodArray = json.append(foodArray,newFood5)]
<!-- Removed branching statement inserted assert statement -->
<!-- If user selected 'No' abort process, notify user -->
[h: assert(response == 0,"<b>Carbs are bad... M'kay!.<b>",0)]
<!-- Seperate the good groups -->
[h, FOREACH(food, foodArray), CODE:
{
[h: foodGroup = json.get(food,"group")]
[h, IF(foodGroup == "Fruit"), CODE:
{
[h: fruitArray = json.append(fruitArray,food)]
}]
[h, IF(foodGroup == "Meat"), CODE:
{
[h: meatArray = json.append(meatArray,food)]
}]
}]
[h: output = "Meat: "+ meatArray +"<BR>Fruit: "+ fruitArray]
<!-- Removed branching statement -->
<!-- Output results -->
[r: output]