How would I make the output field TALLER for when it gets multiple matches?
Flow:
[{"id":"change-set-searchtitle","type":"change","z":"b8111f78dd481d81","name":"Set search title","rules":[{"t":"set","p":"searchtitle","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":4640,"y":290,"wires":[["function-search-and-format"]]},{"id":"38f453df81316559","type":"ui_text_input","z":"b8111f78dd481d81","name":"","label":"Input","tooltip":"","group":"42f742fbc1b5a034","order":1,"width":0,"height":0,"passthru":true,"mode":"text","delay":"00","topic":"topic","sendOnBlur":false,"className":"","topicType":"msg","x":4480,"y":290,"wires":[["change-set-searchtitle"]]},{"id":"183d4cc6e4f63f21","type":"inject","z":"b8111f78dd481d81","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"toy story","payloadType":"str","x":4490,"y":340,"wires":[["change-set-searchtitle"]]},{"id":"6684929d5c688330","type":"inject","z":"b8111f78dd481d81","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"tomorrow","payloadType":"str","x":4490,"y":380,"wires":[["change-set-searchtitle"]]},{"id":"58e262b80987dd9e","type":"inject","z":"b8111f78dd481d81","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"unfindable","payloadType":"str","x":4490,"y":420,"wires":[["change-set-searchtitle"]]},{"id":"function-search-and-format","type":"function","z":"b8111f78dd481d81","name":"Search and format results","func":"let searchTerm = msg.searchtitle.trim().toLowerCase(); // Normalize the search term to lowercase\n\nif (!searchTerm) {\n node.warn(\"Search term is empty.\");\n msg.payload = \"Please enter a search term.\";\n return msg;\n}\n\n// Assuming the dvdIndex is set properly and contains an array of DVD objects\nlet dvdIndex = flow.get(\"dvdIndex\");\n\nif (!dvdIndex || !Array.isArray(dvdIndex) || dvdIndex.length === 0) {\n node.warn(\"No DVD data found in flow context.\");\n msg.payload = \"No DVDs available to search.\";\n return msg;\n}\n\nlet results = dvdIndex.filter((dvd) => {\n // Check if the search term is in the title (case insensitive)\n return dvd.title.toLowerCase().includes(searchTerm);\n});\n\n// If no results are found\nif (results.length === 0) {\n msg.payload = \"No search results found.\";\n return msg;\n}\n\nlet output = \"\";\n\n// Loop through the matching results and format the output\nresults.forEach((result) => {\n // Ensure we have a valid result object and location data\n if (result.location) {\n output += `Found: \"${result.title}\" Location: ${result.location.location},<br>section ${result.location.box}, Row: ${result.location.row}, Position: ${result.location.position}<br><br>`;\n } else {\n // If no location found, indicate it in the output\n output += `Found: \"${result.title}\" but no location information available.<br><br>`;\n }\n});\n\nmsg.payload = output.trim();\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":4860,"y":290,"wires":[["96bf171221f663ea"]]},{"id":"96bf171221f663ea","type":"ui_text","z":"b8111f78dd481d81","group":"42f742fbc1b5a034","order":2,"width":"0","height":"0","name":"","label":"result","format":"{{msg.payload}}","layout":"row-spread","className":"","x":5050,"y":290,"wires":[]},{"id":"42f742fbc1b5a034","type":"ui_group","name":"DVD search","tab":"9e1ed5e519ff655f","order":4,"disp":true,"width":"10","collapse":false,"className":""},{"id":"9e1ed5e519ff655f","type":"ui_tab","name":"TEST2","icon":"dashboard","order":39,"disabled":false,"hidden":false}]
(Forgive the inject
nodes. They're for testing)
(it's 23:36 here... I'm tired. See you tomorrow!)
And again: Thanks for the replies.