First time here? Check out the Help page!
1 | initial version |
I would use runner.workflow.workflowSteps to get both measure inputs and runner.registerValue information on upstream measures. It should work locally on PAT or on the Server
The code below will add an info statement for every measure argument and every runner.registerValue. It even returns values for downstream measure arguments that have not run yet.
If your reporting measures save data from sql queries as a runner.registerValue then you can get that here as well (only for upstream measures that have already run).
# 2.x methods (currently setup for measure display name but snake_case arg names)
runner.workflow.workflowSteps.each do |step|
if step.to_MeasureStep.is_initialized
measure_step = step.to_MeasureStep.get
measure_name = measure_step.measureDirName
if measure_step.name.is_initialized
measure_name = measure_step.name.get # this is instance name in PAT
end
if measure_step.result.is_initialized
result = measure_step.result.get
result.stepValues.each do |arg|
name = arg.name
value = arg.valueAsVariant.to_s
runner.registerInfo("#{measure_name}: #{name} = #{value}")
end
else
#puts "No result for #{measure_name}"
end
else
#puts "This step is not a measure"
end
end
A PAT project script would have access to this same information but across multiple datapoints.