Converting a STRING in to a INTEGER

(imported topic written by Matt.Johnson)

I have the following relevance:

if ((exists key “HKEY_LOCAL_MACHINE\Software\Symantec\SharedDefs” of registry) AND (exists value “NAVCORP_70” of key “HKEY_LOCAL_MACHINE\Software\Symantec\SharedDefs” of registry)) then (preceding text of last “.” of following text of last “” of (value “NAVCORP_70” of key “HKEY_LOCAL_MACHINE\Software\Symantec\SharedDefs” of registry as string)) else “Not Installed”

It answers with 20120706 which is simply a data code. The REG_SZ is longer, it is simply taking what is between the last / and .

That said, I need to write a relevance that says if the date in this string is older than the date I put in as a variable in the relevance that it equates to TRUE. All in the same relevance code.

Everything I have read and tried to convert the REG_SZ to a integer has failed and I am at the end of my knowledge.

Examples of the final code would be greatly appreciated.

(imported comment written by jeremylam)

I think you just have to cast twice, once from the registry key value type, then to the string type, then again to the integer type.

q: (it, type of it) of value "foo" of key "HKEY_CURRENT_USER\Software\BigFix\RelevanceDebugger" of registry
A: 20120709, REG_SZ
I: singular ( registry key value, registry key value type )
q: (it as string as integer | -1) of value "foo" of key "HKEY_CURRENT_USER\Software\BigFix\RelevanceDebugger" of registry
A: 20120709
I: singular integer
q: ((it as string as integer | -1) of value "foo" of key "HKEY_CURRENT_USER\Software\BigFix\RelevanceDebugger" of registry) > 20120101
A: True
I: singular boolean

(imported comment written by Matt.Johnson)


Thank you. I put this code in to the debugger and tested it. (replacing foo with NAVCORP_70) it keeps erroring our. If you could you please give me an example of the correct full relevance I would greatly appreciate it.