Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a list of items that need to be checked against a list of conditions. What i need to do is check each item against each condition, then show which conditions it meets. Is there a simple way to do this in QV?
Example:
Item:
hostName: Host1
OS: OS3
hostStatus: Powered Off
Conditions:
Host Name contains "1"
OS is >2
hostStatus is "powered Off"
The ideal output would list off the above conditions that the item has met
Hi Alex,
See the attached QVW and excel, to see if that's what you want.
Bellow an explanation of the used code.
// Loads the table with the items
Items:
LOAD HostName,
OS,
[Status Names]
FROM
(ooxml, embedded labels, table is Names);
// Loads the table with the conditions
Conditions:
LOAD Contains,
Greater,
[Status Condition]
FROM
(ooxml, embedded labels, table is Conditions);
// joins the tables so each condition is set to each item
join (Items)
Load
*
Resident Conditions;
// creates the final table
finalTable:
Load
HostName,
OS,
[Status Names],
Contains,
Greater,
[Status Condition],
// if the string has something like the Contains field, 1
if(index(HostName,Contains)>0,1,0) as [Flag meets condition 1],
// if the os number is greater or equal to the field in Greater, 1
if(mid(OS,3,len(OS))>=Greater,1,0) as [Flag meets condition 2],
// Compares both status to check if they're equal
if(Upper([Status Names])=Upper([Status Condition]),1,0) as [Flag meets condition 3]
Resident Items;
drop tables Conditions,Items;
Felipe.