Skip to main content

Split test example

  • May 16, 2017
  • 1 reply
  • 0 views

Here is an example of how to take a string and split it into pieces..

Sub SPLITTEST_EXAMPLE()
' HERE IS AN EXAMPLE OF HOW TO PROVIDE A LIST AND THEN SPLIT THAT LIST AND USE IT WITH A FOR-NEXT LOOP
' BUTCH JONES 5/15/2017
' CODED IN MICRO FOCUS REFLECTION - DESKTOP Pro EDITION, VERSION 16.0 SP-1

Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer

Const NEVER_TIME_OUT = 0

Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M

Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen

LF = Chr(10)
CR = Chr(13)

'<=====================================================

Dim LISTS As String

LISTS = "COAG,XE-5000,XT-4000i,URINALYSIS/URINE MICRO,MISC URINALYSIS TESTS,DIFFS/S 4," & _
"MISC HEMATOLOGY TESTS,5600 BOTH,GENEXPERT,NOVA,SED RATES (CDD-WK),SPECIAL HEMATOLOGY," & _
"POLYMEDCO,TOSOH8,VIDAS,"

SPLITTEST = Split(LISTS, ",")
'DATA WILL BE SPLIT AND PARSED ON THE COMMA SEPARATING EACH LOADLIST/INSTRUMENT
'SPLITTEST(0) = COAG
'SPLITTEST(1) = XE-5000
'SPLITTEST(2) = etc.....
'<=====================================================>

With Session

For Each x In SPLITTEST

If x = "" Then
MsgBox "GREAT JOB BUTCH, YOUR DONE"
osCurrentScreen.SendKeys "Clear instrument/worklist"
osCurrentScreen.SendControlKey ControlKeyCode_Return
Else
'=========================
MsgBox "THE LIST YOU SHOULD SEE IS : " & x
'=========================
End If


Next

End With

Exit Sub


End Sub


#Reflection
#Desktop

1 reply

Here is an example of how to take a string and split it into pieces..

Sub SPLITTEST_EXAMPLE()
' HERE IS AN EXAMPLE OF HOW TO PROVIDE A LIST AND THEN SPLIT THAT LIST AND USE IT WITH A FOR-NEXT LOOP
' BUTCH JONES 5/15/2017
' CODED IN MICRO FOCUS REFLECTION - DESKTOP Pro EDITION, VERSION 16.0 SP-1

Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer

Const NEVER_TIME_OUT = 0

Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M

Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen

LF = Chr(10)
CR = Chr(13)

'<=====================================================

Dim LISTS As String

LISTS = "COAG,XE-5000,XT-4000i,URINALYSIS/URINE MICRO,MISC URINALYSIS TESTS,DIFFS/S 4," & _
"MISC HEMATOLOGY TESTS,5600 BOTH,GENEXPERT,NOVA,SED RATES (CDD-WK),SPECIAL HEMATOLOGY," & _
"POLYMEDCO,TOSOH8,VIDAS,"

SPLITTEST = Split(LISTS, ",")
'DATA WILL BE SPLIT AND PARSED ON THE COMMA SEPARATING EACH LOADLIST/INSTRUMENT
'SPLITTEST(0) = COAG
'SPLITTEST(1) = XE-5000
'SPLITTEST(2) = etc.....
'<=====================================================>

With Session

For Each x In SPLITTEST

If x = "" Then
MsgBox "GREAT JOB BUTCH, YOUR DONE"
osCurrentScreen.SendKeys "Clear instrument/worklist"
osCurrentScreen.SendControlKey ControlKeyCode_Return
Else
'=========================
MsgBox "THE LIST YOU SHOULD SEE IS : " & x
'=========================
End If


Next

End With

Exit Sub


End Sub


#Reflection
#Desktop
Another handy way to display test or debug output using VBA (other than "MsgBox") is to use "Debug.Print". This will send text to the "intermediate" window in the VBA environment, which you can make visible by typing Ctrl g, or it is also on the View menu.