Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4541
  • Last Modified:

VBScript help: Loop through comma delimited string

Hi All,

I am not a VBScript guy but Dymo label is only called through VBScript:
<SCRIPT LANGUAGE=VBScript>
Sub Btn1_onclick()
  Dim DymoAddIn, DymoLabel, lAddress, lnbrOfLabels
  Set DymoAddIn = CreateObject("DYMO.DymoAddIn")
  Set DymoLabel = CreateObject("DYMO.DymoLabels")
  DymoAddIn.Open "C:\Documents and Settings\All Users\Documents\DYMO Label\Label Files\STRCToteBoxLabel.LWL"
// NEED LOOP SYNTAX
CONTINUE BOOLEAN:=true;
LOOP WHILE CONTINUE
// THIS WILL RETURN A COMMA DELIMITED LIST OF LOCATIONS, ALPHA-NUMERIC CHARACTER STRING
  lBxLabelList = getToteBarcode()  //THIS IS GOOD... JS FUNCTION THAT GETS LIST OF LOCATIONS
  IF lBxLabelList is null THEN CONTINUE = FALSE; END IF;
  lBxLabel:=SUBSTRING OR FIND OR MID ???? TO GET FIRST LOCATION IN COMMA DELIMITED LIST.
  DymoLabel.SetAddress 2, lBxLabel
  DymoAddIn.Print lnbrOfLabels, TRUE
END LOOP;
End Sub
</SCRIPT>

Thank you for your help,
Bill
0
bcarlis
Asked:
bcarlis
  • 2
  • 2
2 Solutions
 
Wayne Taylor (webtubbs)Commented:
Hi bcarlis,

You can use the Split function....

    lBxLabel = Split(lBxLabelList, ",")(0)

Regards,

Wayne
0
 
Wayne Taylor (webtubbs)Commented:
Or, you can use a combination of Left and InStr....

    lBxLabel = Left(lBxLabelList, InStr(lBxLabelList, ",")-1)

Wayne
0
 
bcarlisAuthor Commented:
Great! But can you give me the syntax for the loop too!
And how to access the split array.. I know no VB syntax... I'm javascript and PL/SQL only
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
To loop thru all entries in the comma seperated list:

   lBxLabelList = getToteBarcode()
   values = Split(lBxLabelList, ",")
   For i = 0 To Ubound(values)
      lBxLabel = values(i)
      DymoLabel.SetAddress 2, lBxLabel
     DymoAddIn.Print lnbrOfLabels, TRUE
   Next
0
 
bcarlisAuthor Commented:
Awesome! That you both!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now