01-03-2019 11:53 AM
Hello,
I'm trying to parse generated XML reports back into TestStand / PropertyObject. The ultimate goal is to insert data from reports into a database.
I could successfully load the report into the Report object with
RunState.Execution.Report.Load()
The documentation offers a method Report.AsPropertyObject:
Returns the underlying PropertyObject that represents the Report object. Use the PropertyObject to modify, add, or remove custom properties for the object.
But I'm unable to get to the value the PropertyObject holds. Running
RunState.Execution.Report.AsPropertyObject().DisplayPropertiesDialog()
displays that the propertyObject has no value although the loaded report has some data and I could verify correct loading of the report by calling
RunState.Execution.Report.Save()
which successfully saves the report's contents to a new location.
Can anyone advice on using the Report class or any other way to load the report into TS variables?
Thank you
01-03-2019 04:33 PM
I'm a little confused here. Why don't you just turn on the database logging feature?
01-04-2019 05:12 AM
- because I'm trying to process already existing xml reports, I'm not running the sequences now, (although I have access to these sequences with which the reports have been created).
01-07-2019 11:09 AM
How are you loading the reports into the report object? I don't think what you are doing will be the best way to accomplish this.
Seems like you need a good XML parser. I definitely wouldn't use TestStand for this sort of activity. Personally I prefer LabVIEW for stuff like this.
Not sure how familiar you are with the report object but you need to inject stuff into it in order for it to work like I think you are going for. At that point you've already parsed your XML and may as well just shoot it into the DB.
01-08-2019 03:26 AM
@~jiggawax~ wrote:
How are you loading the reports into the report object?
with
RunState.Execution.Report.Load()
This is the "XML parser" for the Report object. After Load() is called the object is properly filled with data from the xml file. I can see this because after finishing the sequence which Load()s the report the report which popups in the report tab is the loaded report (not a report of the 'loading' sequence). Now at this point my interest is to access the loaded report object as a PropertyObject so that i could manipulate the already well structured data.
The issue is that calling AsPropertyObject() on the report object doesn't seem to do anything.
01-08-2019 08:37 AM
So you are correct that Load() will indeed bring the report on disk into the Report object. Unfortunately I don't understand what you are expecting as subproperties. When I did this I don't see any subproperties. What do you think is going to be "already well structured data"?
From my understanding the report is just an object and the All property contains the entire string. The reason that you can see the report nicely formatted in the report tab is because under the hood internet explorer is rendering the XML. The report object itself has no awareness of the format of the report and does not support iterating through specific formats.
As you append data to the report you can create sections. Unfortunately, since you are using the Load function to read the entire report then there aren't any sections for that instance of the report. This is demonstrated by calling Report.ReportSection and noting that it is indeed set to Nothing (equivalent of Null in TestStand). If you look through the plugins you will notice how these sections are used and appended to as the automation executes.
Hope this helps,