Hi @ts111 and welcome.
I concur with the other guys that your approach is perfectly reasonable, and pretty much identical to how I initially implemented this functionality. However, you’ve touched on a problem that every developer now faces, dreaded ‘reports’. Results viewer does a nice job accessing, drilling and displaying results, but correct if I’m wrong, it sounds like you will be capturing data to display in a report eventually and be looking to develop your report creation tool maybe.
I usually have the step decide where to put the file from the instrument by calling the capture method with the file path, i.e. Oscilloscope.ScreenCapture(string fullPath).
var filePath = @"C:\ScreenShots\SomeImage.png";
var resParams = new ResultParameters
new ResultParameter("", name: "Param1", "SomeValue1"),
new ResultParameter("", name: "Param2", "SomeValue2"),
new ResultParameter("", name: "Param3", "SomeValue3"),
new ResultParameter("", name: "PathToFile", filePath),
new ResultParameter("", name: "FileTitle", "SomeTitle"),
Results.Publish("SomeResult", resParams.Select(x => x.Name).ToList(), resParams.Select(x =>x.Value).ToArray());
I eventually moved to a MongoDB ResultListener that stores everything published, basically just like a CSV file but in a database. All my steps now record data in the same way, whether it’s large data arrays, images or multiple results. It was relatively straightforward from that point to develop another app and write queries to extract the data and produce tabulated results for as .xlsx, .docx or HTML.
Unfortunately, Publish and PublishTable do not yet have the ability to accept other parameters, like a file, so I had to implement some workarounds in the ResultListener to look for PathToFile so it knew what to do with it, which one way you could try.
Hopefully, it would be good to see more advanced publishing methods future though.