- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise
- >
- Why does this not work?
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 08:38 AM
07-11-2023 08:38 AM
Why does this not work?
This is regular ol’ Javascript, right? Why am I gettting an error trying to filter the resultant strings that come back?
if (input.targetcloud && input.targetgroup) {
for (var x = 0; x < data.length; x++) {
if data[x].name.includes(“dhcp”)
results.push({name:data.name, value:data.id});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 09:42 AM
07-11-2023 09:42 AM
Re: Why does this not work?
Could you please confirm straight quotation marks (" ") around DHCP.
if (data.name.includes("dhcp")) {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 09:49 AM
07-11-2023 09:49 AM
Re: Why does this not work?
I got it working with this finally:
if (input.targetcloud && input.targetgroup) {
for (var x = 0; x < data.length; x++) {
name = data[x].name;
let ans = name.includes("dhcp")
if (ans)
results.push({name:data[x].name, value:data[x].id});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 09:26 AM
07-11-2023 09:26 AM
Re: Why does this not work?
Error Executing Javascript Translation Script for OptionTypeList CAT-NETWORKLIST - SyntaxError: Unnamed:9:27 Expected an operand but found error if (data.name.includes(“dhcp”)) { ^ Unnamed:11:4 Expected eof but found } } ^
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2023 08:57 AM
07-11-2023 08:57 AM
Re: Why does this not work?
Hi Wittling,
could you please try the below? Could you please confirm if you comment the IF condition, is that works?
if (input.targetcloud && input.targetgroup) {
for (var x = 0; x < data.length; x++) {
if (data.name.includes(“dhcp”)) {
results.push({ name: data.name, value: data.id });
}
}
}
Thanks
Velan