Jump to content

Fix number format


GDad7627

Recommended Posts

I am not a programmer but have a VBScript that I need to modify to fix the format of a number.

 

I have two fields that are being captured and I need to combine them and pad one with zeros

 

Input

District = 01

Location = 13 0010 0020 0030

 

Output

Location = 01 0013 0010 0020 0030

 

Here is the code I am working with.

 

 

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]

'This is the code to create IBM's automation COM object to
'obtain data directly from the screen.

Set autECLConnList = CreateObject("PCOMM.autECLConnList")

Set autECLPSObj = CreateObject("PCOMM.autECLPS")

autECLConnList.Refresh

autECLPSObj.SetConnectionByHandle(autECLConnList(1).Handle)

'Create the Books Connect object.

Set proxy = CreateObject("SLWindowObject.Proxy.SLWindowProxy")

'Create the configurations, setting both
'application and window name. Window name
'need not be the same as the actual application
'data is being pulled from.

proxy.SetApplicationName("AS400 Client Access")

proxy.SetWindowName("Tax Collections and Tickets")

'This checks to see what screen we are currently on and
'changes the screen positioning accordingly.

IF autECLPSObj.GetText(4, 35, 13) = "Screen Name" THEN

Call proxy.AddField("Year", autECLPSObj.GetText(5, 27, 4), True)

Call proxy.AddField("Type Number", Trim(autECLPSObj.GetText(5, 32, 12)), True)

Call proxy.AddField("Account Number", autECLPSObj.GetText(5, 56, 8), True)

Call proxy.AddField("Payer", Trim(autECLPSObj.GetText(7, 8, 30)), True)

Call proxy.AddField("District", autECLPSObj.GetText(6, 53, 2), True)

Call proxy.AddField("Location", autECLPSObj.GetText(7, 56, 20), True)

END IF

proxy.UpdateInteraction

proxy.LaunchRemote

 

 

 

Any help would be great.

GDad

Link to comment
Share on other sites

It looks like there are some functions here to do left and right padding in VBScript:

 

http://www.vbforums.com/showthread.php?676463-Right-Pad-and-Left-Pad-in-VBScript

 

You can use that to pad your value with zeros to a certain length, and to concatenate 2 string values you just use the & operator, e.g. val3 = val1 & val2.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...