Checking for missing values while using tuple in relevance

(imported topic written by SystemAdmin)

Relevance:

exists file “/opt/sni/unix/etc/bladeinfo” and (tuple string item 7 of concatenation ", " of substrings separated by “:” of line whose ( it contains “HS21”) of file “/opt/sni/unix/etc/bladeinfo” as version < ")

TRUE Sample:

rdcbc001mm:02:uxprd105:HS21:1.07:1.04:1.11:1.4.11.38e:enabled

FALSE Sample:

rdcbc001mm:02:uxprd105:HS21:1.07:1.04:1.11:1.4.11.43:enabled

Need these to also be FALSE? How can I code relevance for these to be FALSE?

rdcbc001mm:02:uxprd105:HS21:1.07:1.04:1.11::

rdcbc001mm:02:uxprd105:HS21:1.07:1.04:1.11:Not Available:enabled

I will get TRUE for the first and FALSE for the second

But how would I check for NO Value or “Not Available” to get a false answer?

Any help would be appreciated…

(imported comment written by Lee Wei)

This might work, please give it a try.

exists file “/opt/sni/unix/etc/bladeinfo” and (if (exists it as version) then (it as version < ") else (false) ) of (tuple string item 7 of concatenation ", " of substrings separated by “:” of line whose ( it contains “HS21”) of file “/opt/sni/unix/etc/bladeinfo”)

Lee Wei

(imported comment written by SystemAdmin)

Not quite… I get a true answer, expecting a false

rdcbc001mm:11:lnxlab28:HS21:1.02:1.00:1.04::

(imported comment written by Lee Wei)

What does your complete file look like?

If this is the only line, it will work.

However, if there are other “HS21” lines in the file, then your original construct does not work after splitting and combining the elements together.

(imported comment written by SystemAdmin)

The sample above is the only line in the file

(imported comment written by Lee Wei)

Jeff,

We must be missing something obvious.

I cannot reconcile the behavior that you are seeing.

(imported comment written by SystemAdmin)

You have an extra : after 1:02 that’s making your result false, mine is true, but needs to return false for the lack of a value in the 7th position

Q: lines of file “/opt/sni/unix/etc/bladeinfo”

A: cbcbc003mm:04:uxlab023:HS21:1.21:1.08:1.23::

T: 160

Q: tuple string item 7 of concatenation ", " of substrings separated by “:” of line whose ( it contains “HS21”) of file “/opt/sni/unix/etc/bladeinfo”

A:

T: 295

Notice an empty or null value

Q: exists file “/opt/sni/unix/etc/bladeinfo” and (if (exists it as version) then (it as version < ") else (false) ) of (tuple string item 7 of concatenation ", " of substrings separated by “:” of line whose ( it contains “HS21”) of file “/opt/sni/unix/etc/bladeinfo”)

A: True

T: 8137

The above needs to be false, not true

(imported comment written by SystemAdmin)

Another option would be to force a value into position 7 when the bladeinfo file is created such as “N/A”.

Does that help? If the value of position 7 is “N/A” return false, else compare as version

(imported comment written by SystemAdmin)

I think the problem is that item 7 of your custom tuple exists, its just that its an empty string. In windows, if you try to cast that as a version it not work (making that if statement false, cause the whole expresssion to work as you want it to)

In unix system however i think you are allowed to make empty strings versions in relevance (since unix versions are more flexable than windows). You might want to change your expression to check that the length of the tuple string, rather than if it can be caste into a version:

Q: (if (length of it > 0) then (it as version < ") else (false) ) of (tuple string item 7 of concatenation ", " of substrings separated by “:” of “rdcbc001mm:11:lnxlab28:HS21:1.02:1.00:1.04::”)

A: False

T: 0.143 ms

A: False

(imported comment written by MarkA.Stevens)

I have to admit that I am partial to regular expressions rather than using concatentations and first/last of “:” So that said, here is my suggestion for

TRUE Sample:

rdcbc001mm:02:uxprd105:HS21:1.07:1.04:1.11:1.4.11.38e:enabled

Q: if ( exists (matches (regex "

(

:+):frowning:

:

+):frowning:

:

+):frowning:

:

+):frowning:

:

+):frowning:

:

+):frowning:

:

+):frowning:

^:

+):(.*)$") of (lines of file “/opt/sni/unix/etc/bladeinfo” as string)) whose (parenthesized part 8 of it as version < ")) then (true) else (false)

A: True

T: 658

IHTH … Mark