{
  "productInfo" : {
    "company" : "HighByte",
    "product" : "IntelligenceHub",
    "version" : "4.3.1",
    "build" : "2025.11.17.5",
    "stage" : "Release"
  },
  "project" : {
    "version" : 12,
    "connections" : [ {
      "name" : "WhileExamplesMQTT",
      "uri" : "mqtt://localhost:1885",
      "tags" : [ "While" ],
      "writes" : {
        "flattenModeledValues" : false
      },
      "subscriptions" : { },
      "storeForward" : {
        "enabled" : false,
        "maxEntries" : 100,
        "waitOnFailureInterval" : {
          "duration" : 1,
          "units" : "Seconds"
        }
      },
      "settings" : {
        "connectionTimeoutSeconds" : 10,
        "keepAliveSeconds" : 60,
        "requestTimeoutMS" : 5000,
        "maxInflight" : 1000,
        "cleanSession" : true,
        "mcpEnabled" : "disabled",
        "ssl" : false,
        "redundantBrokers" : [ ],
        "inputDiscovery" : "#"
      }
    }, {
      "name" : "WhileExamplesMSSQL",
      "uri" : "jdbc.sqlserver://52.10.6.4:1433",
      "tags" : [ "While" ],
      "writes" : {
        "flattenModeledValues" : false
      },
      "subscriptions" : { },
      "storeForward" : {
        "enabled" : false,
        "maxEntries" : 100,
        "waitOnFailureInterval" : {
          "duration" : 1,
          "units" : "Seconds"
        }
      },
      "settings" : {
        "database" : " KnowledgeBase",
        "username" : "highbyte",
        "password" : "password",
        "strategy" : {
          "type" : "default"
        }
      }
    } ],
    "inputs" : [ {
      "name" : "Orders",
      "connection" : "WhileExamplesMSSQL",
      "type" : "jdbc.sqlserver",
      "qualifier" : {
        "type" : "query",
        "query" : "SELECT *\nFROM [KnowledgeBase].[dbo].[Orders]\nOrder by _id",
        "index" : {
          "enabled" : false,
          "indexName" : "",
          "indexValue" : ""
        }
      },
      "cacheLifetime" : {
        "enabled" : false
      },
      "template" : {
        "type" : "Off"
      },
      "parameters" : {
        "type" : "EmptyParameters"
      }
    } ],
    "outputs" : [ ],
    "modeling" : {
      "models" : [ ],
      "instances" : [ ]
    },
    "conditions" : [ ],
    "functions" : [ ],
    "tags" : [ {
      "name" : "While"
    } ],
    "pipelines" : [ {
      "name" : "WhileBadConnectionRetry",
      "tags" : [ "While" ],
      "inputStages" : [ "While_Read" ],
      "stages" : [ {
        "name" : "While_Read",
        "display" : {
          "position" : {
            "x" : 347,
            "y" : -121
          },
          "size" : {
            "width" : 1900,
            "height" : 325
          },
          "metadata" : { }
        },
        "config" : {
          "type" : ".WhileLoopConfig",
          "failureOutputs" : [ ],
          "loopOutputs" : [ "Orders" ],
          "stageTimeout" : {
            "duration" : 30,
            "units" : "Seconds"
          },
          "expression" : "// loop until DataFound === true\r\nreturn loop.metadata.DataFound === false",
          "loopValue" : "ACCUMULATED"
        },
        "outputs" : [ "CheckArrayLength" ]
      }, {
        "name" : "FalseDataFound",
        "display" : {
          "position" : {
            "x" : 650,
            "y" : 185
          },
          "metadata" : {
            "parent" : "While_Read"
          }
        },
        "config" : {
          "type" : ".JavaScriptTransformConfig",
          "transformExpression" : "stage.setMetadata(\"DataFound\", false);\r\nstage.setValue(event.value);\r\n\r\n"
        },
        "outputs" : [ "Delay" ]
      }, {
        "name" : "TrueDataFound",
        "display" : {
          "position" : {
            "x" : 1100,
            "y" : 50
          },
          "metadata" : {
            "parent" : "While_Read"
          }
        },
        "config" : {
          "type" : ".JavaScriptTransformConfig",
          "transformExpression" : "stage.setMetadata(\"DataFound\", true);\r\nstage.setValue(event.value);\r\n\r\n"
        },
        "outputs" : [ "Return" ]
      }, {
        "name" : "Orders",
        "display" : {
          "position" : {
            "x" : 200,
            "y" : 117
          },
          "metadata" : {
            "parent" : "While_Read"
          }
        },
        "config" : {
          "type" : ".ReadConfig",
          "failureOutputs" : [ "FalseDataFound" ],
          "reference" : {
            "type" : "Input",
            "name" : "Orders",
            "path" : "",
            "params" : { },
            "connectionName" : "WhileExamplesMSSQL"
          }
        },
        "outputs" : [ "TrueDataFound" ]
      }, {
        "name" : "Delay",
        "display" : {
          "position" : {
            "x" : 1100,
            "y" : 185
          },
          "metadata" : {
            "parent" : "While_Read"
          }
        },
        "config" : {
          "type" : ".DelayConfig",
          "delay" : {
            "duration" : 10,
            "units" : "Seconds"
          }
        },
        "outputs" : [ "Return" ]
      }, {
        "name" : "Return",
        "display" : {
          "position" : {
            "x" : 1550,
            "y" : 117
          },
          "metadata" : {
            "parent" : "While_Read"
          }
        },
        "config" : {
          "type" : ".ReturnConfig"
        },
        "outputs" : [ ]
      }, {
        "name" : "WhileExamples",
        "display" : {
          "position" : {
            "x" : 2874,
            "y" : -6
          }
        },
        "config" : {
          "type" : ".DynamicWriteConfig",
          "failureOutputs" : [ ],
          "connectionReference" : "{{Connection.WhileExamplesMQTT}}",
          "qualifier" : {
            "topic" : "WhileExamples",
            "qos" : 0,
            "namedRoot" : false,
            "retained" : true,
            "breakupArrays" : false
          },
          "qualifierExpression" : "",
          "writeReturn" : "ignore"
        },
        "outputs" : [ ]
      }, {
        "name" : "CheckArrayLength",
        "display" : {
          "position" : {
            "x" : 2386,
            "y" : 10
          }
        },
        "config" : {
          "type" : ".SwitchConfig",
          "switchCases" : [ {
            "expression" : "return Boolean(event.value.length > 0)",
            "outputs" : [ "WhileExamples" ],
            "description" : "ArrayLengthGTZero"
          }, {
            "expression" : "return true",
            "outputs" : [ ],
            "description" : "Default"
          } ],
          "evaluationType" : "onFirst"
        },
        "outputs" : [ ]
      } ],
      "trackActivity" : false,
      "triggers" : [ ],
      "errorHandler" : {
        "type" : "default"
      }
    }, {
      "name" : "WhileExample",
      "tags" : [ "Loops", "While" ],
      "inputStages" : [ "While" ],
      "stages" : [ {
        "name" : "While",
        "display" : {
          "position" : {
            "x" : 345,
            "y" : -105
          },
          "size" : {
            "width" : 1450,
            "height" : 300
          },
          "metadata" : { }
        },
        "config" : {
          "type" : ".WhileLoopConfig",
          "failureOutputs" : [ ],
          "loopOutputs" : [ "SetKeepLooping" ],
          "stageTimeout" : {
            "duration" : 30,
            "units" : "Seconds"
          },
          "expression" : "return loop.metadata.KeepLooping;",
          "loopValue" : "INCOMING"
        },
        "outputs" : [ ]
      }, {
        "name" : "Milliseconds100",
        "display" : {
          "position" : {
            "x" : 650,
            "y" : 105
          },
          "metadata" : {
            "parent" : "While"
          }
        },
        "config" : {
          "type" : ".DelayConfig",
          "delay" : {
            "duration" : 100,
            "units" : "Milliseconds"
          }
        },
        "outputs" : [ "Return" ]
      }, {
        "name" : "Return",
        "display" : {
          "position" : {
            "x" : 1100,
            "y" : 105
          },
          "metadata" : {
            "parent" : "While"
          }
        },
        "config" : {
          "type" : ".ReturnConfig"
        },
        "outputs" : [ ]
      }, {
        "name" : "SetKeepLooping",
        "display" : {
          "position" : {
            "x" : 200,
            "y" : 105
          },
          "metadata" : {
            "parent" : "While"
          }
        },
        "config" : {
          "type" : ".JavaScriptTransformConfig",
          "transformExpression" : "// randomly sets value between 0.0 and 1.0\r\nconst value = Math.random();\r\nif (value < 0.1)\r\n{\r\n    stage.setMetadata(\"KeepLooping\", false);\r\n}\r\nelse\r\n{\r\n    stage.setMetadata(\"KeepLooping\", true);\r\n}\r\n\r\n// set value to see what it was\r\nevent.value.value = value;\r\n\r\nstage.setValue(event.value);"
        },
        "outputs" : [ "Milliseconds100" ]
      } ],
      "trackActivity" : false,
      "triggers" : [ ],
      "errorHandler" : {
        "type" : "default"
      }
    } ],
    "namespace" : [ ]
  },
  "network" : {
    "groups" : [ ],
    "hubs" : [ ]
  }
}