Im trying to modify the AdHocGroupWizard.ojo, when we add computer names, depending where they come from may have 2 different prefixes
“hsrv” or “hprt” on the front of the name, currently we just strip them off and run the AdHocGroupWizard, I would like to check if it begins
with either of the 2 or neither
here is the original line
var rel = ‘ids of bes computers whose (name of it as lowercase = "’+ chomp(names+.toLowerCase()) + ‘")’;
the “hsrvserver01” is a computer name I paste into the AdHocGroupWizard which is above “chomp(names+.toLowerCase())”
ids of bes computers whose (name of it as lowercase = ((substring after “hsrv” of it) or (substring after “hprt” of it) of “hsrvserver01”))
(doesnt work…)
so i guess ultimately i’m trying to check if it starts with either of the 2 prefixes or not and then strip it off and check for a computer name
…
and where I want to go with this wizard, would to have a radio button that would allow me to choose either name or IP or any other identifying column per server
so it would be a little more flexible then just computer name
the computer name is normal (server01) a field called “CMDB Primary name” has the “hsrv” or the other in it, so I wanted to strip the name off the
input field and then check it against the computer name
the “hsrvserver01” is a computer name I paste into the AdHocGroupWizard which is above “chomp(names+.toLowerCase())” the real computer name is server01
this is why I was trying to strip it off below
ids of bes computers whose (name of it as lowercase = ((substring after “hsrv” of it) or (substring after “hprt” of it) of “hsrvserver01”))
so the “CMDB primary name” could either be hsrvserver01 or hprtserver01 or server01, I want to strip of the hprt or hsrv and compare it to server01
something like this
names of bes computers whose (name of it as lowercase = (((substring after
"hsrv" of it) or (substring after
"hprt" of it) or (name of it)) of
"hsrvserver01")) names of bes computers whose (name of it as lowercase = (((substring after
"hsrv" of it) or (substring after
"hprt" of it) or (name of it)) of
"hprtserver01")) names of bes computers whose (name of it as lowercase = (((substring after
"hsrv" of it) or (substring after
"hprt" of it) or (name of it)) of
"server01"))
so either of the above 3 lines will return the same name “server01”,
all three are the same name “server01” it just depends on how I recieve the data and who’s sending it,
var rel = ‘ids of bes computers whose ((length of name of it >= 4 AND following text of first 4 of name of it as lowercase = "’+ chomp(names+.toLowerCase()) + ‘") OR name of it as lowercase = "’+ chomp(names+.toLowerCase()) + ‘" )’;
The above will allow any 4 letter prefix. It should be easy to change it to check against your specific prefix if you need it to be more specific.