Relevance for if number value is less than

I have a file that contains a version number. Is there a way to use relevance for “if the version is less than a specific number”?

As an example today I am doing something like the below. This essentially runs on all hosts where that version does not exist. The problem with this is it also will run when if the version is higher than 1.259.304. I need to adjust it to only run if the version is less than 1.259.304

exists file “/tmp/installer.version” whose (not exists lines whose (it contains “1.259.304”) of it)

Might be better if you post an example file but yes, something like this should work but note this will most-likely fail if file has any other lines apart from the version one, even if it a blank line; if there are additional characters and so on around the actual version; etc - it just won’t be able to convert that line to a type “version”, hence asking for the example file.

exists file "/tmp/installer.version" whose (not exists lines whose (it as version <"1.259.304") of it)

Apologies on not supplying the log contents. Below is an example of the entire log, it only ever has the version (no quotes in the log, nothing but what you see below). I prefer to not have to supply the entire version and only supply 1.267.125 instead. Initial testing of what you supplied this does seem to work.

1.267.125.20230613-102915

You may need to apply some parsing if you want to skip the date and the number after the dash, something like this should do it:

exists file "/tmp/installer.version" whose (not exists lines whose (((tuple string item 0 of it & "." & tuple string item 1 of it & "." & tuple string item 2 of it) of (concatenation ", " of substrings separated by "." of it)) as version <"1.259.304") of it)

But again, I am more concerned with what would happen if the file has an additional line (either blank or with some text) and whether it would not cause error of some sorts, so you might want to test those scenarios (intentionally add a line or something)

// Assumptions:
// File Exists
// File will contain only 1 line

q: line 1 of file "C:\Temp\test.txt"
A: 1.267.125.20230613-102915
T: 0.875 ms
I: singular file line

q: line 1 of file "C:\Temp\test.txt" as version
A: 1.267.125.20230613
T: 0.579 ms
I: singular version

q: line 1 of file "C:\Temp\test.txt" as version < "1.267.126" as version
A: True
T: 0.318 ms
I: singular boolean
1 Like