ExpandNumSortedChar method (WinStudio scripts)

Applies To

IWSApplication interface

Definition

Pads a numeric or alphanumeric string with spaces or zeroes.

Syntax

Application.ExpandNumSortedChar( string, integer )

  Part   Description
string Required. The original string before it has been padded.
integer Required. The length the string is to be when it has been padded.

Remarks

This method appends spaces to the left of a string of numerals. With the string 23 and a length parameter of 5, the method returns "   23".

The method inserts zeroes between the alphabetic and numeric parts of a string of the type abc999. With the string D23 and a length parameter of 5, the method returns D0023.

Strings expanded in this way can be sorted like numbers.

Example

Sub Main
   Dim Length As Integer
   Dim CustNum As String
   Dim CustSeq As String
   CustNum = ThisForm.Variables("CustNumV").Value
   CustSeq = ThisForm.Variables("CustSeqV").Value
   ' Ensure CustNum is properly expanded
   If ThisForm.PrimaryIDOCollection.IsPropertyNumSortedChar("CustNum") Then
      Length = ThisForm.PrimaryIDOCollection.GetPropertyLength("CustNum")
      If (Length > 0 And CustNum <> "") Then
         CustNum = Application.ExpandNumSortedChar(CustNum, Length)
      End If
   End If
End Sub