I am using the following relevance to get some computer properties, it was created by the Excel creator.
however, is this the best way or i can get these properties in much simple way?
Thanks!
( item 0 of it as string & “$x$” &
item 1 of it as string & “$x$” &
item 2 of it as string & “$x$” &
item 3 of it as string & “$x$” &
item 4 of it as string )
of (
(if (exists result (item 0 of it, item 1 of it) and
exists values of result (item 0 of it, item 1 of it) )
then (concatenation “%0A” of values of result (item 0 of it, item 1 of it))
else ("")),
(if (exists result (item 0 of it, item 2 of it) and
exists values of result (item 0 of it, item 2 of it) )
then (concatenation “%0A” of values of result (item 0 of it, item 2 of it))
else ("")),
(if (exists result (item 0 of it, item 3 of it) and
exists values of result (item 0 of it, item 3 of it) )
then (concatenation “%0A” of values of result (item 0 of it, item 3 of it))
else ("")),
(if (exists result (item 0 of it, item 4 of it) and
exists values of result (item 0 of it, item 4 of it) )
then (concatenation “%0A” of values of result (item 0 of it, item 4 of it))
else ("")),
(if (exists result (item 0 of it, item 5 of it) and
exists values of result (item 0 of it, item 5 of it) )
then (concatenation “%0A” of values of result (item 0 of it, item 5 of it))
else ("")))
of (
bes computers,
bes property “BIOS”,
bes property “Full Operating System Name and Service Pack Level - Windows”,
bes property “Wireless Encryption Status - Windows”,
bes property “Wireless SSID - Windows”,
bes property “Computer Name”)
There are different forms to get the properties from the BES Computer object.
Using the form above, here is a simplified version that will give you a better sense of what is going on.
(
values of result (item 0 of it, item 1 of it),
values of result (item 0 of it, item 2 of it),
values of result (item 0 of it, item 3 of it)
)
of (
bes computers,
bes property "Last Report Time",
bes property "BIOS",
bes property "Computer Name"
)
This simple form does not include formatting and error checking provided by the Excel Connector.
Mainly, if any of your computers are not returning any of the properties, you will get an error. If a property (e.g. wireless SSID) returns multiple values, the Excel Connector example concatenates them into a single row.
You might end up working yourself back to the original statement.
Here is another example construct for you.
(
name of it,
values of property results whose (name of property of it = "OS") of it,
values of property results whose (name of property of it = "IP Address") of it
)
of bes computers
The first line “name of it” is possible because the BES Computer object has an attribute call “name”.
Other attributes of BES Computer are “Operating System”, “CPU”, and etc.
However, most properties of BES Computers are not accessed that way. This is where the 2nd form comes in.
I have included “OS” and “IP Address” for you to see the difference. When the results are more than one, you will get multiple lines for your output. If you want to have only one line for one Computer, you can try the following instead.
(
name of it,
values of property results whose (name of property of it = "OS") of it,
(concatenations of (values of it as string)) of property results whose (name of property of it = "IP Address") of it
)
of bes computers