{"id":3265,"date":"2024-08-15T14:53:02","date_gmt":"2024-08-15T11:53:02","guid":{"rendered":"https:\/\/docs.unibell.tech\/?page_id=3265"},"modified":"2024-08-16T09:41:52","modified_gmt":"2024-08-16T06:41:52","slug":"var-search","status":"publish","type":"page","link":"https:\/\/docs.unibell.tech\/?page_id=3265","title":{"rendered":"Var search"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/docs.unibell.tech\/wp-content\/uploads\/2024\/08\/variable-search_1.png\"><img decoding=\"async\" width=\"116\" height=\"88\" src=\"https:\/\/docs.unibell.tech\/wp-content\/uploads\/2024\/08\/variable-search_1.png\" alt=\"\" class=\"wp-image-3422\"\/><\/a><\/figure>\n\n\n\n<p>This block is used to check if this variable exists. This block has two outputs: \u2018Found\u2019 and \u2018Not found\u2019, and therefore two paths of a scenario.<\/p>\n\n\n\n<p>This block has the \u2018Variable\u2019 and \u2018Nested object\u2019 fields. When an embedded object is specified the system will check if the object exists in the variable\u2019s data structure. (More details about an embedded object you can find in the \u2018<a href=\"https:\/\/docs.unibell.tech\/?page_id=3256\" data-type=\"page\" data-id=\"837\">Variab<\/a><a href=\"https:\/\/docs.unibell.tech\/?page_id=3256\" data-type=\"page\">l<\/a><a href=\"https:\/\/docs.unibell.tech\/scenario\/%d0%bf%d0%b5%d1%80%d0%b5%d0%bc%d0%b5%d0%bd%d0%bd%d0%b0%d1%8f\/\" data-type=\"page\" data-id=\"837\">e<\/a>\u2019 block).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/docs.unibell.tech\/wp-content\/uploads\/2024\/08\/variable-search_2.png\"><img decoding=\"async\" width=\"264\" height=\"220\" src=\"https:\/\/docs.unibell.tech\/wp-content\/uploads\/2024\/08\/variable-search_2.png\" alt=\"\" class=\"wp-image-3423\"\/><\/a><\/figure>\n\n\n\n<p>To search in an array that comes, for example, from an HTTP request (which is saved and stored in a variable, such as var1):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;\n{\n   \"name\":\"Ford\",\n   \"val\":\"John\",\n   \"price\":\"1000\",\n   \"cars\":&#91; \"Ford\", \"BMW\", \"Fiat\" ]\n},\n{\n   \"name\": \"BMW\",\n   \"val\":\"Jack\",\n   \"price\":\"2000\",\n   \"cars\":&#91; \"Ford\", \"BMW\", \"Fiat\" ]\n},\n{\n   \"name\": \"Fiat\",\n   \"val\":\"Nik\",\n   \"price\":\"3000\",\n   \"cars\":&#91; \"Ford\", \"BMW\", \"Fiat\" ]\n}\n]<\/code><\/pre>\n\n\n\n<p>To find the &#8220;Fiat&#8221; cars, you need to specify the following in the script fields:<br>var1[0].cars[2]<br>To do this, you need to specify in the fields:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Variable: var1<\/li>\n\n\n\n<li>Nested object: [0].cars[2]<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/docs.cpaas.mittoapi.net\/wp-content\/uploads\/2024\/06\/variable2.png\"><img decoding=\"async\" src=\"https:\/\/docs.cpaas.mittoapi.net\/wp-content\/uploads\/2024\/06\/variable2.png\" alt=\"\" class=\"wp-image-3540\"\/><\/a><\/figure>\n\n\n\n<p>This will create the element of the array var1[0].cars[2].<\/p>\n\n\n\n<p><br>This block can be used before the &#8220;Variable&#8221; and &#8220;Variable Analysis&#8221; blocks to have the system check the variable&#8217;s existence before assigning a value to it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This block is used to check if this variable exists. This block has two outputs: \u2018Found\u2019 and \u2018Not found\u2019, and therefore two paths of a scenario. This block has the \u2018Variable\u2019 and \u2018Nested object\u2019 fields. When an embedded object is specified the system will check if the object exists in the variable\u2019s data structure. (More <a href=\"https:\/\/docs.unibell.tech\/?page_id=3265\" class=\"more-link\">&#8230;<span class=\"screen-reader-text\">  Var search<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"tpl\/scenario-personal.php","meta":{"footnotes":""},"class_list":["post-3265","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=\/wp\/v2\/pages\/3265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3265"}],"version-history":[{"count":4,"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=\/wp\/v2\/pages\/3265\/revisions"}],"predecessor-version":[{"id":3473,"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=\/wp\/v2\/pages\/3265\/revisions\/3473"}],"wp:attachment":[{"href":"https:\/\/docs.unibell.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}