Combining two relevance clauses using "|"

(imported topic written by Darknight)

Hi All,

i have two relevance as below :

q:
(
if

(name

of

operating system

as

lowercase

contains

“sun”
)

then

(
""
)

else

if

(
exists

dmi)

then

(unique values

of

processor_manufacturers

of

processor_informations

of

dmi)

else

(
""
))

whose

(
it

does not contain

“0”
)

A:
GenuineIntel

T:
0.267 ms

q:if (windows of operating system) then(if exists (string values of selects “Level from Win32_Processor” of wmi) then (string values of selects “Level from Win32_Processor” of wmi) else ("")) else ("")

A:6

T:16.491 ms

i want to combine these two statements to have belwo result :

GenuineIntel | 6

Please let me know whether this is possible … if yes please advise…

(imported comment written by Darknight)

Can someone please assit here…

(imported comment written by BrianPGreen)

Does it work to just combine them with “&”? Like:

((
if

(name

of

operating system

as

lowercase

contains

“sun”
)

then

(
""
)

else

if

(
exists

dmi)

then

(unique values

of

processor_manufacturers

of
processor_informations

of

dmi)

else

(
""
))

whose

(
it

does not contain

“0”
))
&(
if

(windows

of

operating system)

then
(
if

exists

(string values

of

selects

“Level from Win32_Processor”

of

wmi)

then

(string values

of

selects

“Level from Win32_Processor”

of
wmi)

else

(
""
))

else

(
""
))

(imported comment written by Darknight)

Nopes i get below error :

q:
((
if

(name

of

operating system

as

lowercase

contains

“sun”
)

then

(
""
)

else

if

(
exists

dmi)

then

(unique values

of

processor_manufacturers ofprocessor_informations

of

dmi)

else

(
""
))

whose

(
it

does not contain

“0”
))

&
(
if

(windows

of

operating system)

then
(
if

exists

(string values

of

selects

“Level from Win32_Processor”

of

wmi)

then

(string values

of

selects

“Level from Win32_Processor”

of

wmi)

else

(
""
))

else

(
""
))

E:
A singular expression is required.

I am aware about relevance clause which i have developed as below , as you will notice the properties which i am combining by & “|” & in the below mentioned clause have common factor that is these all properties are getting extarcted via wmi and hence its easy to combine , but i am not sure how to combine ites which do not have common factor like the one which i have mentioned above. as you can see one property is being extarcted via dmi and second one is wmi and also these are multiline output as number of processors decides the number of lines of output:

q:/Capabilities_CDROMDrive/ if (unix of operating system) then ("") else if (exists wmi) then (((if exists (string value of property “Capabilities” of it)then (if (string value of property “Capabilities” of it is equal to “0”) then (“unknown”)else if (string value of property “Capabilities” of it is equal to “1”) then (“Other”) else if (string value of property “Capabilities” of it is equal to “2”) then (“Sequential Access”) else if (string value of property “Capabilities” of it is equal to “3”) then (“Random Access”)else if (string value of property “Capabilities” of it is equal to “4”)then (“Supports Writing”) else if (string value of property “Capabilities” of it is equal to “5”)then (“Encryption”) else if (string value of property “Capabilities” of it is equal to “6”) then (“Compression”) else if (string value of property “Capabilities” of it is equal to “7”)then (“Support Removable Media”)else if (string value of property “Capabilities” of it is equal to “8”)then (“Manual Cleaning”) else if (string value of property “Capabilities” of it is equal to “9”)then (“Automatic Cleaning”)else if (string value of property “Capabilities” of it is equal to “10”)then (“SMART Notification”)else if (string value of property “Capabilities” of it is equal to “11”)then (“Supports Dual-Sided Media”)else if (string value of property “Capabilities” of it is equal to “12”)then (“Predismount Eject Not Required”)else “”) else “” )& “|” & (if exists (string value of property “CompressionMethod” of it) then (string value of property “CompressionMethod” of it) else ("")) & “|” & (if exists (string value of property “DefaultBlockSize” of it) then (string value of property “DefaultBlockSize” of it) else ("")) & “|” & (if exists (string value of property “MaximumComponentLength” of it) then (string value of property “MaximumComponentLength” of it) else ("")) & “|” & (if exists (string value of property “MaxMediaSize” of it) then (string value of property “MaxMediaSize” of it) else ("")) & “|” & (if exists (string value of property “MediaType” of it) then (string value of property “MediaType” of it) else (""))& “|” &(if exists (string value of property “MinBlockSize” of it) then (string value of property “MinBlockSize” of it) else ("")) & “|” & (if exists (string value of property “NumberOfMediaSupported” of it) then (string value of property “NumberOfMediaSupported” of it) else ("")) & “|” & (if exists (string value of property “PNPDeviceID” of it) then (string value of property “PNPDeviceID” of it) else (""))& “|” & (if exists (string value of property “PowerManagementCapabilities” of it) then (if (string value of property “PowerManagementCapabilities” of it is equal to “0”) then (“unknown”)else if (string value of property “PowerManagementCapabilities” of it is equal to “1”) then (“Not Supported”) else if (string value of property “PowerManagementCapabilities” of it is equal to “2”) then (“Disabled”) else if (string value of property “PowerManagementCapabilities” of it is equal to “3”) then (“Enabled”)else if (string value of property “PowerManagementCapabilities” of it is equal to “4”)then (“Power Saving Modes Entered Automatically”) else if (string value of property “PowerManagementCapabilities” of it is equal to “5”)then (“Power State Settable”) else if (string value of property “PowerManagementCapabilities” of it is equal to “6”) then (“Power Cycling Supported”) else if (string value of property “PowerManagementCapabilities” of it is equal to “7”)then (“Timed Power-On Supported”)else “”) else (""))& “|” & (if exists (string value of property “PowerManagementSupported” of it) then (string value of property “PowerManagementSupported” of it) else (""))& “|” & (if exists (string value of property “TransferRate” of it) then (string value of property “TransferRate” of it) else (""))) of it of select objects “Capabilities, CompressionMethod, DefaultBlockSize, MaximumComponentLength, MaxMediaSize, MediaType, MinBlockSize, NumberOfMediaSupported, PNPDeviceID, PowerManagementCapabilities, PowerManagementSupported, TransferRate from Win32_CDROMDrive” of wmi) else ("")

A:|Unknown||||DVD-ROM|||IDE\CDROMNECVMWAR_VMWARE_IDE_CDR10_______________1.00____\5&3A794E10&0&1.0.0|||-1

A:|Unknown||||DVD-ROM|||IDE\CDROMNECVMWAR_VMWARE_IDE_CDR10_______________1.00____\5&3A794J20&0&1.0.0|||

Please advise.

(imported comment written by BrianPGreen)

The “A singular expression is required” error is happening because to combine the two relevance expressions as string, they have to return just one value. I suspect that you can change the left side of the expression from “unique values of processor_manufacturers of processor_informations of dmi” to one of:

unique value of processor_manufacturers of processor_informations of dmi

or

concatenation of unique values of processor_manufacturers of processor_informations of dmi

(imported comment written by Darknight)

Hi Brian … thanks for the help … i recitfied that expression and got the result , but waht i want to achive is to combine all the below mentioned relevance in a one property to have results as mention below :

expected result :

A:
GenuineIntel | 6 | | False | 9 | Xeon | Ok | 3 | 4

GenuineIntel | 6 | | False | 9 | Xeon | Ok | 3 | 4

the separate properties are as shown below:

q:
/Manufacturer Name - Processor/

(
if

(name

of

operating system

as

lowercase

contains

“sun”
)

then

(
""
)

else

if

(
exists

dmi)

then

( processor_manufacturers

of

processor_informations

of

dmi

as

string)

else

(
""
))

whose

(
it

does not contain

“0”
)

A:
GenuineIntel

A:
GenuineIntel

T:
0.200 ms

q:
/Level_Processor/

if

(windows

of

operating system)

then
(
if

exists

(string values

of

selects

“Level from Win32_Processor”

of

wmi)

then

(string values

of

selects

“Level from Win32_Processor”

of

wmi)

else

(
""
))

else

(
""
)

A:
6

A:
6

T:
14.112 ms

q:
/PNPDeviceID_Processor/

if

(unix

of

operating system)

then

(
""
)

else

if

(windows

of

operating system)

then

(
if

exists

(string values

of

selects

“PNPDeviceID from win32_Processor”

of

wmi)

then

(string values

of

selects

“PNPDeviceID from win32_Processor”

of

wmi)

else

(
""
))

else

(
""
)

A:

T:
7.996 ms

q:
/PowerManagementSupported_Processor/

if

(unix

of

operating system)

then

(
""
)

else

if

(windows

of

operating system)

then

(
if

exists

(string values

of

selects

“PowerManagementSupported from win32_Processor”

of

wmi)

then

(string values

of

selects

“PowerManagementSupported from win32_Processor”

of

wmi)

else

(
""
))

else

(
""
)

A:
False

A:
False

T:
15.347 ms

q:
/ProcessorArchitecture_Processor/

if

(name

of

operating system

as

lowercase

contains

“sun”
)

then

(types

of

processors

as

string)

else

if

(name

of

operating system

as

lowercase

contains

“linux”
)

then

(parenthesized parts

1

of

(matches (regex

“ProcessorArchitecture=(.+)”
)

of

it
)

of

lines

whose

(
it

contains

“ProcessorArchitecture=”
)

of

file

“inventory.txt”

of

folder

“__HardwareInfo”

of

client folder

of

site

whose

(name

of

it

starts with

“actionsite”
))

else

if

(windows

of

operating system)

then

(
if

exists

(string values

of

selects

“Architecture from win32_Processor”

of

wmi)

then

(string values

of

selects

“Architecture from win32_Processor”

of

wmi)

else

(
""
))

else

(
""
)

A:
9

A:
9

T:
14.747 ms

q:
/ProcessorFamily_Processor/

family names

of
processors

A:
Xeon

A:
Xeon

T:
0.043 ms

q:
/ProcessorStatus_Processor/

if

(name

of

operating system

as

lowercase

contains

“sun”
)

then

(states

of

processors

as

string)

else

if

(name

of

operating system

as

lowercase

contains

“linux”
)

then

(
if

(
exists

dmi)

then

(unique values

of

statuss

of

processor_informations

of

dmi

as

string)

else

(
""
))

else

if

(windows

of

operating system)

then

(
if

exists

(string values

of

selects

“Status from win32_Processor”

of

wmi)

then

(string values

of

selects

“Status from win32_Processor”

of

wmi

as

string)

else

(
""
))

else

(
""
)

A:
OK

A:
OK

T:
14.746 ms

q:
/ProcessorType_Processor/

if

(name

of

operating system

as

lowercase

contains

“sun”
)

then
(type

of

processor

as

string)

else

if

(name

of

operating system

as

lowercase

contains

“linux”
)

then

(parenthesized parts

1

of

(matches (regex

“Processor_Type:(.+)”
)

of

it
)

of

lines

whose

(
it

contains

“Processor_Type:”
)

of

file

“inventory.txt”

of

folder

“__HardwareInfo”

of

client folder

of

site

whose

(name

of

it

starts with

“actionsite”
))

else

if

(windows

of

operating system)

then

(
if

(
exist

(string values

of

selects

“ProcessorType from win32_Processor”

of

wmi))

then

(string values

of

selects

“ProcessorType from win32_Processor”

of

wmi)

else

(
""
))

else

(
""
)

A:
3

A:
3

T:
14.999 ms

q:
/UpgradeMethod_Processor/

if

(unix

of

operating system)

then

(
if

(
exists

dmi)

then

(unique values

of

processor_upgrades

of

processor_informations

of

dmi

as

string)
else

(
“N/A”
))

else

if

(windows

of

operating system)

then

(
if

(
exists

(string values

of

selects

“UpgradeMethod from Win32_Processor”

of

wmi))

then

(string values

of

selects

“UpgradeMethod from Win32_Processor”

of

wmi)

else

(
""
))

else

(
""
)

A:
4

A:
4

T:
17.759 ms

as menioned in my previous post i can combine the individual relevance if the are getting evaluated by single method that is either by wmi or by dmi or purely through relevance , but in the above case its the mixture of all and i am bit confused how i can combine thses results in a single relevance clause and get the desired output.

Please assist me.

(imported comment written by Darknight)

Hi Brian , could you please provide some hint to get the required result.

Thanks in advance

(imported comment written by Darknight)

Can someone please provide reply…

(imported comment written by Darknight)

Any suggestion to get the required results … hints please…

(imported comment written by Darknight)

any help ?

(imported comment written by jgstew)

See my latest answer here:
https://www.ibm.com/developerworks/community/forums/html/topic?id=e575c45e-1db0-4fd4-bc8f-6d2df262feb9

As Brian points out, your issue is having a plural result in a string concat (&), which will not work. You have to make it singular by using “unique value” or (concatenation “” of it) of …

(imported comment written by Darknight)

thanks a trillion Brian and jgstew for your excellent support and help :slight_smile: