Cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting Data to Excel via Testlab Automation

Hello,

 

for me it's the first time that I am using Testlab Automation and I am struggling to export some measured data from my LMS project into an Excel-file. With a VBA script in Excel I manage to access the folder structure of the sections and runs in my LMS project, but I don't know how to export data into my open Excel file.

 

The commands I am using are:

Set my_db = TL.ActiveBook.Database

Set my_att = my_db.ElementNames("")

tmp_t = my_db.ElementType(my_att.item(i))

 

With those commands I can retrieve the structure and the names of folders etc. In the object library I've found the command my_db.GetItem(). With that I can get the number of Data-Points in a specified measurement (Like Overall Level Data from Channel1). But I still don't get the actual data, just the amount of data points.

 

How can I get all the data points from a given measurement and store them in an Excel range?

4 REPLIES

Re: Exporting Data to Excel via Testlab Automation

Siemens Genius Siemens Genius
Siemens Genius

in attach you can find a small code example on how Test.Lab Automation is working.

special on how to retrieve datapoints from a datablock.

 

for more info and detailed explanation and deeper insights, contact your PLM contact person for dedicated Test.Lab Automation training.

Re: Exporting Data to Excel via Testlab Automation

Hello bvlassa,

thank you very much for the fast and helpful answer! I managed to retrieve the information I was looking for.

For others who might be interested, here is the code I used to get Overall level data (section and run_name still have to be filled):

Path = section & "/" & run_name & "/Tracked processing/Fixed sampling/Time/Sections/Overall level"
Set att3 = my_db.ElementNames(Path)

Path2 = Path & "/" & att3(0)
att4 = my_db.ElementType(Path2)

Set dataBlock = my_db.GetItem(Path2)
Xvalues = dataBlock.Xvalues
YRealValues = dataBlock.RealYValues
YUserValues = dataBlock.UserYValues(LMSTestLabAutomation.CONST_ScaleProperty.dB_Scale)
XLange = dataBlock.XCount
label = dataBlock.label
YValues = dataBlock.YValues
YQuantity = dataBlock.YQuantity
XQuantity = dataBlock.XQuantity
YAxisId = dataBlock.YAxisId
XAxisId = dataBlock.XAxisId
LengthX = UBound(Xvalues)

Re: Exporting Data to Excel via Testlab Automation

Hello everyone!

 

Recently I asked about how to read out data from a LMS project using Excel and VBA. Thanks to the help I managed to read out all post-processed data. However now I am stuck trying to read out the original measured time data.

How can I access the throughput data? I tried the following:

 

Dim dataBlock as LMSTestlabAutomation.IBlock2

Set att = my_db.ElementNames(PathToThroughput) Path2 = PathToThroughput & att.item(0) Set dataBlock = my_db.GetItem(Path2)

 

 

I get the following error: "Runtime error '13': Types mismatching"

I suspect I need to use another variable type than IBlock2. But I don't know what.

 

my_db.ElementType(Path2) yields 'BlockStream'
So the question would be how do I access a BlockStream?

 

Any help is gladly appreciated.

Re: Exporting Data to Excel via Testlab Automation

Siemens Genius Siemens Genius
Siemens Genius

Dear,

 

for better searching keys can you create a new forum topic ?

 

thanks