{"id":21319,"date":"2022-04-11T13:56:08","date_gmt":"2022-04-11T11:56:08","guid":{"rendered":"https:\/\/help.openbee.com\/open-bee-scan-capture\/knowledge-base\/how-to-guides\/scripts-in-capture\/case-studies\/index\/index-create-a-drop-down-list-from-the-values-of-a-file\/"},"modified":"2026-05-13T09:36:49","modified_gmt":"2026-05-13T07:36:49","slug":"index-create-a-drop-down-list-from-the-values-of-a-file","status":"publish","type":"page","link":"https:\/\/help.openbee.com\/en\/open-bee-scan-capture\/knowledge-base\/how-to-guides\/scripts-in-capture\/case-studies\/index\/index-create-a-drop-down-list-from-the-values-of-a-file\/","title":{"rendered":"Index: Create a drop-down list from the values of a file"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\" id=\"Index:Cr&#xE9;erunelisted&#xE9;roulantedepuislesvaleursd'unfichier-Fichier&#xE0;lire\">File to read<\/h3>\n\n<p><a href=\"https:\/\/help.openbee.com\/wp-content\/uploads\/2022\/04\/273356280.csv\">TestlistCode.csv<\/a><\/p>\n\n<h3 class=\"wp-block-heading\" id=\"Index:Cr&#xE9;erunelisted&#xE9;roulantedepuislesvaleursd'unfichier-Script\">Script<\/h3>\n\n<pre class=\"wp-block-code\"><code>var result = new JSE_Result();\nvar content = JSE_File.readFile('C:\\OPENBEE\\Test\\TestlistCode.csv');\nif(content == null || content == \"\")\n\treturn result;\nvar list = content.split(\"\\n\");\nif(list.length == 0)\n\treturn result;\n\nvar code = getTextFromIndexInfo(getFirstIndexFromID(pParameters, \"CODE_INDEX\"));\nvar values = &#91;];\nvalues.push(\"\");\n\nfor(var i=0;i&lt;list.length;i++){\n\tvar line = list&#91;i].split(\";\");\n\tif(line != null &amp;&amp; line.length > 0){\n\t\tvalues.push(line&#91;0].trim());\n\t\tif(line&#91;0] != null &amp;&amp; line&#91;0] != \"\" &amp;&amp; line&#91;0] == code)\n\t\t\tresult.calculatedValue = line&#91;0].trim();\n\t}\n}\nresult.values = values;\nreturn result;<\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"Index:Cr&#xE9;erunelisted&#xE9;roulantedepuislesvaleursd'unfichier-R&#xE9;sultat\">Result<\/h3>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/help.openbee.com\/wp-content\/uploads\/2022\/04\/273356278.png\" alt=\"\"\/><\/figure>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/help.openbee.com\/wp-content\/uploads\/2022\/04\/273356279.png\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>File to read TestlistCode.csv Script Result<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":21276,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"templates\/ob-help-products.php","meta":{"footnotes":""},"class_list":["post-21319","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/comments?post=21319"}],"version-history":[{"count":1,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21319\/revisions"}],"predecessor-version":[{"id":21324,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21319\/revisions\/21324"}],"up":[{"embeddable":true,"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/pages\/21276"}],"wp:attachment":[{"href":"https:\/\/help.openbee.com\/en\/wp-json\/wp\/v2\/media?parent=21319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}