Fluent Control: Accessing Data in Arrays with VBs?

Thought I’d ask the community,

Have any of you had success accessing variables stored in an array on Fluent Control through a VB script?

1 Like

I have certainly done it in Evoware. I think at one point I was pulling volumes from an array and using the tip number or well position as the element in the array. Don’t think I ever tried it in FluentControl. What’s the problem you’re seeing?

I’m not the expert on FluentControl, but a dear colleague of mine is and provided this:

I remembered I looked into arrays in the past and found them impossible to pass with the normal variable transfer mechanism (Host.GetVariable and Host.SetVariable). But, it was possible to work with individual fields in the array by using Host.ResolveExpression. Example:

Imports Microsoft.VisualBasic
Imports System
Imports Tecan.Core.Scripting

Public Class TestClass
Implements IScriptObject

Private Host As IScriptingHost

Public Property ScriptingHost() As IScriptingHost Implements IScriptObject.ScriptingHost
    Get
        Return Host
    End Get
    Set(ByVal value As IScriptingHost)
        Host = value
    End Set
End Property

Public Sub Execute() Implements IScriptObject.Execute
    Dim strTest As String
    Dim intTest As Integer

    'get ubound of an array
    intTest = Host.ResolveExpression("count(arrayStr[])")
	
    'get a value from an array
    strTest = Host.ResolveExpression("arrayStr[4]")
	
    'set a value in the array
    Host.ResolveExpression("arrayStr[4]:=""cat""")
	
End Sub

End Class

2 Likes

Thanks Kevin, I’ll try this out today.

I ended up creating a workaround but prefer the simplicity of a lone VB.

It worked, thank you!

I’m surprised this isn’t given as an example but then again the manual starts to get sparse… real quick.

1 Like

Yeah, if you’re not sticking to things you can do in the GUI the manual isn’t of much use.

1 Like