Showing results for 
Search instead for 
Do you mean 
Solved! Go to solution

Getting Data from TDF block

Hello community


I'm using Automation and C# for controlling Test.Lab and I'm having next problem.


I can get block of post-processing data by next code:


LMSTestLabAutomation.IData datablocknot;
LMSTestLabAutomation.IBlock2 blocknot;
String dataPath = "ordertracking/Run 1/Fixedsampling/Runup/Sections/Frequencies/Frequency 25.00 Hz Point4";

 datablocknot = database.GetItem(dataPath);
 blocknot = (LMSTestLabAutomation.IBlock2)datablocknot;

In this code I get data from database by method .GetItem(Path To Top) and then convert IData type to IBlock2 type.  So good, it's works.



Now, I can get IData block of pre-processing data in "Throughput" by code:

LMSTestLabAutomation.IData newBlock;

newBlock = database.GetItem("ordertracking/Run 1/Throughput/1"); 

String typeNewBlock = newBlock.Type;
//Type is LmsHq::DataModelC::TDFExpression::CTDFBlockStream

But I CAN'T convert IData type to IBlock2 type. Furthermore, I can not do anything with this block!

I can tranfer this block to Input Basket by code:

database.AddToInputBasket("ordertracking/Run 1/Throughput/1");

And this is all.


My task is get numeric data from this block.


How I can convert type IData to other type? How I can get numeric value? Or it is impossible?


If you have example on VB for this task.. Can you demanstrate this? 


Thank you for you help, 




Accepted by topic author IvanFedosv
‎03-12-2017 01:22 AM

Re: Getting Data from TDF block

[ Edited ]

Dear Ivan,


As your starting type is 'BlockStream' it cannot be converted to IBlock2 type directly.


You first need to apply this code (of course first adapt to your content):

IData lc_SrcItem = tl_db.GetItem("Section1/AutoPower/AutoPower Point1:+Z");
        if (lc_SrcItem.IsSubTypeOf("LmsHq::DataModelI::Expression::IBlockStream") != 0)
          AttributeMap lv_attrMap = tl_app.Factory.CreateAttributeMap();
          lv_attrMap.Add("StartValueGiven", false);
          lv_attrMap.Add("StartValue", 0);
          lv_attrMap.Add("NumberOfPoints", 10000);
          lv_attrMap.Add("BlockStream", lc_SrcItem);
          lc_SrcItem = tl_app.Factory.CreateObject("LmsHq::DataModelC::ExprConcat::CBlockStreamToBlock", lv_attrMap);



The result of this you can cast to IBlock2.


Best regards,


Re: Getting Data from TDF block



Thank you for your answer.


It's good answer because it's working! I some modified your code and got result. I'm attaching my code:

 if (newBlock.IsSubTypeOf("LmsHq::DataModelC::TDFExpression::CTDFBlockStream") != 0)
      LMSTestLabAutomation.AttributeMap lv_attrMap;
      lv_attrMap = TL.Factory.CreateAttributeMap();

      lv_attrMap.Add("StartValueGiven", false);

      lv_attrMap.Add("StartValue", 0);

      lv_attrMap.Add("NumberOfPoints", 161888);

      lv_attrMap.Add("BlockStream", newBlock);

      newBlock = TL.Factory.CreateObject("LmsHq::DataModelC::ExprConcat::CBlockStreamToBlock", lv_attrMap);

LMSTestLabAutomation.IBlock2 SuperBlock;

SuperBlock = (LMSTestLabAutomation.IBlock2)newBlock;


I have a few more questions for you:


1) How it works? We create object with attributes and insert BlockStream as attribute. How object converts BlockStream to IBlock2?

2) How do you know this? Maybe you have some interesting documentation...
I'm using "Automation Workbook and Port Documentation", but I didn't know how use paragraph "Data types". Your idea is good key for it! But maybe exist more explanations or examples, how use it. 


Thank you for your attention!

Re: Getting Data from TDF block

Dear Ivan,


I am glad it is working for you!


How it works and how we do it is not documented, as this concerns internal knowhow.


Lots of success with writing your automation program.


Best regards,


Re: Getting Data from TDF block



Would you advice about whre to find the mentioned documentation "Automation Workbook and Port Documentation"?


I Really would appreciate it. I'm only working with the pdf released in the Test.Lab CD and I'm missing more detailed info and examples.


Bes regards



Re: Getting Data from TDF block

Dear Kinetia,


This can be found under:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\LMS Test.Lab version\Tools


If during installation “LMS Test.Lab Demo Data” is installed:

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\LMS Test.Lab version\Demo Data


Best regards,