LogProcessor

More Values Techniques
Login

Techniques to Extract Values

Extracting multiple values from a line and calling separate programs on each:

In your logpro file create a hook and either an expect (can be any of error, warning, ignore or required).

(hook:add "quadval" "echo \"Value1: #{m1}\";echo \"Value2: #{m2}\";echo \"Value3: #{m3}\";echo \"Value4: #{m4}\"") 

;; Use expect:required to extract some values
(expect:required   in "LogFileBody" = 1 "Quad values" #/First:\s+(\d+)\s+Second:\s+(\d+)\s+Third:\s+(\d+)\s+Fourth:\s+(\d+)/ hook: "quadval")

If the logfile for this example contains this line:

// A case where we are capturing multiple values on a single line and exectuting 
// multiple calls to load them

First: 1 Second: 2 Third: 3 Fourth: 4

Then the output will show the calls to echo in the hook:add line:

LOGPRO Required: Quad values = 1 in section LogFileBody on line 40
NONERR HOOK CALLED: echo "Value1: 1";echo "Value2: 2";echo "Value3: 3";echo "Value4: 4"
Value1: 1
Value2: 2
Value3: 3
Value4: 4
First: 1 Second: 2 Third: 3 Fourth: 4

If you are using megatest to capture results and roll them up you could use a hook specification like this:

megatest -set-values :value #{m1} :expected_value 0 :tol 1 :category extents :variable ll :units km 
(hook:add "qualval" (conc 
     "megatest -set-values :value #{m1} :expected_value 0   :tol 1 :category extents :variable first  :units km;"
     "megatest -set-values :value #{m2} :expected_value 0   :tol 1 :category extents :variable second :units km;"
     "megatest -set-values :value #{m3} :expected_value 100 :tol 1 :category extents :variable third  :units km;"
     "megatest -set-values :value #{m4} :expected_value 100 :tol 1 :category extents :variable fourth :units km"))
Note: "conc" is the string concatenation operator in Chicken Scheme.