Cancel
Showing results for 
Search instead for 
Did you mean: 

working with input basket and waterfalls

Creator
Creator

Hi,

I want to work with selection of waterfalls. It works fine with inside database or workspace but I 'm blocking when waterfalls selection is made in the Input basket. How to proceed to acces WF properties or blocks inside it?

Thank you. (using VBA for example)

9 REPLIES

Re: working with input basket and waterfalls

Siemens Genius Siemens Genius
Siemens Genius

Dear,

 

In attach you can find a small document on how th retreive Waterfalls from the InputBasket.

It's a VB.Net example, that is easy to convert towards VBA.

Hope, this will helps.

 

Regards.

Re: working with input basket and waterfalls

Creator
Creator

Hello,

Thank you for this helpful answer.

I just always don't find easy way to take "selected" item in input basket using

datawatch_NavigatorSelection = TL.ActiveBook.FindDataWatch("Navigator_SelectedOIDs")

data_selection = datawatch_NavigatorSelection.Data

data_BlockPath_0 = tl.IData(data_selection.AttributeMap(0))

It works but not with inputbasket.

I think I miss a little thing ...

Thank you.

Re: working with input basket and waterfalls

Siemens Genius Siemens Genius
Siemens Genius

Dear,

 

The port is still valid for the inputbasket.

But, the content, you recieve back is different formatted.

In attach you can find a small dump, maybe this will help.

 

Regards.

Re: working with input basket and waterfalls

Creator
Creator

Hi,

Thank you,

But no so easy do get the path to the waterfall, or we have to rebuild it with string work?

Regards

Re: working with input basket and waterfalls

Siemens Genius Siemens Genius
Siemens Genius

Dear,

 

indeed it's a different approch.

What are you trying to do? Maybe there is a different approch possible?

Why reading inputbasket and then do a selection in Test.Lab?

 

Kind regards,

Re: working with input basket and waterfalls

Creator
Creator

Hello,

Thank you for your help.

I do calculation with two waterfalls (divide and probably need substract)

I do it now with 2 WF in same run, then selection of 2 WF in the folder like "Section1/Waterfalls/Acoustic" works fine.

But if I need to do it with WF of different runs, Input Basket is usefull.

Then I thinking to do idem : 2 selected WF in Input Basket.

But it seems that selected item in Input Basket are not easy to catch...

if It is too hard, I can limit basket content with the 2 WF only. Smiley Happy

Regards

Re: working with input basket and waterfalls

Siemens Genius Siemens Genius
Siemens Genius

Dear,

 

I don't know how your application looks like, but ...

Can you read the inputbasket and then show the result in a datagrid or listview or ...

And make the selection of the 2 waterfalls in you application and not in Test.Lab.

 

So, 1 button to read the content of the inputbasket, 1 button to do the calculatins and 1 grid,.. to display the data.

 

Regards,

Re: working with input basket and waterfalls

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Not sure if this is actually what you are looking for, but the attached function will return the data objects selected in the Navigator.  They are returned as an array of IData objects.  It works if they are directly selected in a project database, or from the Input Basket, or the Search Results.  It also can be used to return the absolute paths to the objects rather than the objects themselves, if you prefer that.

 

    Public Function GetNavSelectedItems() As LMSTestLabAutomation.IData()
        '******************************************************************************
        ' This function reads all selected items in the center pane of the
        ' Test.Lab Navigator worksheet and returns them in an IData array.
        ' (unsupported function for demo purposes)
        '******************************************************************************
        Dim attr As LMSTestLabAutomation.AttributeMap = Nothing
        Dim SelectedObj As LMSTestLabAutomation.IData = Nothing
        Dim LinkAOID As LMSTestLabAutomation.IData = Nothing
        Dim DataObj As LMSTestLabAutomation.IData = Nothing
        Dim DataType As String
        Dim NumSelectedItems As Integer
        Dim NumDataItems As Integer
        Dim i As Integer
        Dim DataObjects() As LMSTestLabAutomation.IData
        Dim PathToTops() As String

        ' Get a datawatch for the selected items
        Dim dwSelection As LMSTestLabAutomation.DataWatch
        dwSelection = TL.ActiveBook.FindDataWatch("Navigator_SelectedOIDs")

        ' Make sure something has been selected
        If dwSelection Is Nothing Then
            MsgBox("Nothing selected in Navigator Selection pane")
            Return Nothing
        End If
        If dwSelection.Data Is Nothing Then
            MsgBox("Nothing selected in Navigator Selection pane")
            Return Nothing
        End If

        ' Get an attribute map containing all the selected items
        attr = dwSelection.Data.AttributeMap

        ' Init variables 
        NumSelectedItems = attr.Count
        NumDataItems = 0
        ReDim PathToTops(NumSelectedItems - 1)
        ReDim DataObjects(NumSelectedItems - 1)

        ' Loop over all the selected items
        For i = 0 To attr.Count - 1
            SelectedObj = attr(i)
            If SelectedObj.Type = "LmsHq::ActiveDataI::DataBBS::CAbsoluteOID" Then
                If TL.FindDataWatch(attr(i)).Data Is Nothing Then
                    MsgBox("Non-endpoint object selected;" & vbCr & SelectedObj.Item("OID/Path/PathString"))
                    Continue For
                End If
                ' get the data object and check its type
                DataObj = TL.FindDataWatch(attr(i)).Data
                DataType = DataObj.Type

                ' if this is a link, get the data object the link points to...
                If InStr(DataType, "DataBBS::CLink") > 0 Then
                    ' this is a Link object
                    ' get the AOID found in the link
                    LinkAOID = DataObj.Item("AbsoluteOID")   '  .AttributeMap.Item(0)
                    PathToTops(NumDataItems) = LinkAOID.Item("OID/Path/PathString")
                    ' get the data object using the AOID found in the link
                    DataObj = TL.FindDataWatch(LinkAOID).Data
                    DataType = DataObj.Type
                End If

                ' add the data item to an array (if it is a supported data type)
                If DataType = "LmsHq::DataModelI::Expression::CBufferIBlock" Then
                    PathToTops(NumDataItems) = SelectedObj.Item("OID/Path/PathString")
                    DataObjects(NumDataItems) = DataObj
                    NumDataItems = NumDataItems + 1
                ElseIf DataType = "LmsHq::DataModelI::Expression::CBufferIBlockStream" Then
                    PathToTops(NumDataItems) = SelectedObj.Item("OID/Path/PathString")
                    DataObjects(NumDataItems) = BlockStreamToBlock(DataObj) 'convert stream to IBlock2 object 
                    NumDataItems = NumDataItems + 1
                ElseIf DataType = "LmsHq::DataModelI::Expression::CBufferIBlockArrayWF" Then
                    PathToTops(NumDataItems) = SelectedObj.Item("OID/Path/PathString")
                    DataObjects(NumDataItems) = DataObj
                    NumDataItems = NumDataItems + 1
                Else
                    MsgBox("Unhandled Datatype: " & DataType & vbCrLf & "Data path: " & SelectedObj.Item("OID/Path/PathString"))
                    'Waterfall:         DataType : "LmsHq::DataModelI::Expression::CBufferIBlockArrayWF"
                    'Datablock:         DataType : "LmsHq::DataModelI::Expression::CBufferIBlock"
                    'Blockstream        DataType : "LmsHq::DataModelI::Expression::CBufferIBlockStream"
                    'Search Results:    DataType : "LmsHq::ActiveDataC::DataBBS::CLinkExtendedInfo"
                    'Input Basket:      DataType : "LmsHq::ActiveDataC::DataBBS::CLink"
                End If
            Else
                MsgBox("Item is not AOID")
            End If
        Next


        ReleaseComObject(attr)
        ReleaseComObject(SelectedObj)
        ReleaseComObject(DataObj)
        ReleaseComObject(LinkAOID)

        ' properly size the arrays containing the selected data
        If NumDataItems > 0 Then
            ReDim Preserve DataObjects(NumDataItems - 1)
            Return DataObjects
            'ReDim Preserve PathToTops(NumDataItems - 1)
            'Return PathToTops
        End If

        Return Nothing

    End Function

Re: working with input basket and waterfalls

Creator
Creator

Hello,

It looks like what I wanted to do. I will study more precisely later.

Thank you very much.

Regards