Using and understanding the Inspector Guides

Hello all,

I’m just starting out and able to understand relevancy code and how syntaxes work, but something I’m struggling with is using the Inspector Guides, especially how to “put everything together” relating to what I find in them. I understand the Creation, Properties and Casts pretty well, but I.D’ing different elements of a syntax and how they work together (or what options are available) is eluding me so far.

Here’s an example:

Q: (month of date (local time zone) of now) as two digits.
A: 07

If I look in the “Time Zone” and “Date” objects, I don’t see anything in it that refers to the elements in the above syntax (although I do see the Month of property in “Date”, but not able to tie everything together from it) that stand out as something I can use if I was creating the above code from scratch.

If I use the Inspector Search (https://developer.bigfix.com/relevance/search/) for the various elements:

Month of date
Local Time Zone
Now
Two digits

I get data for all of them. For instance two digits returns this relevant month-to-string casting operation per the syntax example:

<month> as two digits : string
Converts the month into a two digit number (01 - 12)

And that’'s understandable now that I found it, but if I wasn’t aware of “two digits” as something available to me, I’m struggling to understand how I can use the Inspector Guides to point me in the right direction towards “Two digits”, or any of the other syntax elements, and it’s possible options.

I get this might be too broad of a question, but if anyone has maybe an example of how to track down available options for objects - or even how to get a better understanding of the guides themselves - I’d be most appreciative.

Thanks!

1 Like

Edit: Read my next post first, especially the “Introduction to Relevance” and “Introduction to Action” Guides. The rest of this post is more for how to locate information, once you’re comfortable with the syntax.

One trick, in the Fixlet Debugger, is to hit the “View -> Show Type Information” button…

q: now
A: Tue, 19 Jul 2016 16:28:06 -0500
T: 4.556 ms
I: singular time

And then, the Introspectors (Inspectors of Inspectors) can help point in the right direction…

q: properties of type "time"
A: date <time zone> of <time>: date
A: unique values of <time>: time with multiplicity
A: minima of <time>: time
A: maxima of <time>: time
A: extremas of <time>: ( time, time )
A: time <time zone> of <time>: time of day with time zone
T: 0.271 ms
I: plural property

In your case, the date looks interesting…it takes a “time zone” parameter though. We can find any other properties that look like they return a time zone…

q: properties whose (it as string contains "time zone")
A: date <time zone> of <time>: date
A: universal time zone: time zone
A: local time zone: time zone
A: time zone <string>: time zone
A: unique values of <time zone>: time zone with multiplicity
A: multiplicity of <time zone with multiplicity>: integer
A: unique values of <time of day with time zone>: time of day with time zone with multiplicity
A: multiplicity of <time of day with time zone with multiplicity>: integer
A: time of <time of day with time zone>: time of day
A: zone of <time of day with time zone>: time zone
A: hour_of_day of <time of day with time zone>: integer
A: minute_of_hour of <time of day with time zone>: integer
A: second_of_minute of <time of day with time zone>: integer
A: two digit hour of <time of day with time zone>: string
A: two digit minute of <time of day with time zone>: string
A: two digit second of <time of day with time zone>: string
A: zoned time_of_day <string>: time of day with time zone
A: time <time zone> of <time>: time of day with time zone
A: current time_of_day <time zone>: time of day with time zone
A: current time_of_day: time of day with time zone
T: 9.668 ms
I: plural property

So here the “local time zone” property looks interesting, and is what you want. Likewise you can find the “month” property of type “date”. To figure out your conversion options, you can try “casts from of type” to find the “as two digits” cast.

q: casts from of type "month"
A: <month> as integer: integer
A: <month> as string: string
A: <month> as three letters: string
A: <month> as two digits: string
T: 0.106 ms
I: plural cast

Interestingly, in all of those results the “I:” refers to a Type. Some of those types include “property”, “type”, and “cast”, and you can retrieve the properties of those as well -

q: properties of type "cast"
A: name of <cast>: string
A: operand type of <cast>: type
A: result type of <cast>: type
T: 0.166 ms
I: plural property

q: properties of type "property"
A: singular name of <property>: string
A: plural name of <property>: string
A: usual name of <property>: string
A: result type of <property>: type
A: index type of <property>: type
A: direct object type of <property>: type
A: multivalued of <property>: boolean
A: dependency known of <property>: boolean
T: 0.228 ms
I: plural property

q: properties of type "type"
A: casts from of <type>: cast
A: properties of <type>: property
A: properties <string> of <type>: property
A: properties returning <type> of <type>: property
A: name of <type>: string
A: size of <type>: integer
A: parent of <type>: type
T: 0.245 ms
I: plural property

… you can get a list of all possible properties with “properties” which gives way too many results to post here, but here’s an excerpt:

q: properties
A: binary operators: binary operator
A: binary operators <string>: binary operator
A: binary operators returning <type>: binary operator
A: name of <binary operator>: string
A: symbol of <binary operator>: string
A: result type of <binary operator>: type
A: left operand type of <binary operator>: type
A: right operand type of <binary operator>: type
A: sunday: day of week
A: monday: day of week
A: tuesday: day of week
A: wednesday: day of week
A: october: month
A: november: month
A: december: month
A: month <integer>: month
A: month <string>: month
A: system x32 file <string>: file
A: system x64 file <string>: file
A: registry: registry
A: native registry: registry
A: x32 registry: registry
A: x64 registry: registry
A: key <string> of <registry>: registry key

Usually I start off with the Introspectors, and move on to the Inspector Guide, Inspector List, or the Inspector Search pages from there.

1 Like

Also, to be sure you’re looking at some of the same pages we are, check the following:

Introducing the Relevance Language (best place to start learning)
http://www.ibm.com/support/knowledgecenter/SS63NW_9.0.0/com.ibm.tem.doc_9.0/Platform/Relevance/c_introducing_the_relevance_lang.html

Introducing the Action Language:
http://www.ibm.com/support/knowledgecenter/SS63NW_9.0.0/com.ibm.tivoli.tem.doc_9.0/Platform/Action/c_introduction.html

Inspector Guide (reference):
https://bigfix.me/inspectorguide

Inspectors List:
https://support.bigfix.com/inspectors/Action%20Objects_Any.html

Inspector Search:
http://support.bigfix.com/inspectorsearch/inspector_search.html

Bigfix.me (Community Site, shared Fixlets/Analyses)
www.bigfix.me
(It’ll be a lot easier to read some of the community-created Relevance/Actions/Analyses than for a lot of the default content; I think a lot of the default content is automatically-generated and not meant to be human-readable.)

The “as” in the command shows that this is a “cast” in relevance.

It means take the object that has an output of a different type and cast it (if possible) to the new type

Thanks, Alan! Kinda buried in that fairly long original post of mine, but I do know that was a cast.

One of the easiest ways is to go to the base type on the developer page. It shows you everything you can do with that type

https://developer.bigfix.com/relevance/reference/month.html

You notice near the bottom all the casts.

Jason, thanks so much!

I am using the guides you mentioned in your other post; in fact, the example I gave was from the Relevance Guide.

But this post I think will be especially useful. I’m aware of how to pull properties of objects in the Debugger as well as the Introspectors, but haven’t dived too deeply into that aspect just yet.

I suspect getting more proficient with tracking down available options, keywords and commands with the various objects gets easier with experience. Thinking it will be one of those “Ah!” scenarios.