Sub routine now working

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Sub routine now working

Post by gchichester » Thu Sep 15, 2011 2:39 pm

Would anyone please review this code and attached images and show me why I'm getting these errors.

[b]This Code is working correctly[/b]
[code]
SRT>GetContractNum
Let>k=0
GetDialogProperty>BolDialog,ShipperName,Text,ShpName
GetDialogProperty>BolDialog,CarrierCode,Text,SLCode
Label>Start
Let>k=k+1
ReadLn>C:\CP_Macros\Asia\aContract.txt,k,strLine
If>strLine=##EOF##,end
Separate>strLine,comma,aContract
If>{(%ShpName% = %aContract_1%) AND (%SLCode% = %aContract_2%)}
SetDialogProperty>BolDialog,SrvContract,Text,%aContract_3%
EndIf
Goto>Start
Label>end
END>GetContractNum
[/code]

[b]Data in test file aContract.txt[/b]
DNE,APLU,GB10/0294
DNE,MAEU,457725
DNE,MOLU,5045311B10


[b]This is the code that get an error at[/b] - If>{(%ShpName% = %eContract_1%) AND (%SLCode% = %eContract_2%)}

[code]
SRT>GetContractNum
Let>k=0
GetDialogProperty>BolDialog,ShipperName,Text,ShpName
GetDialogProperty>BolDialog,CarrierCode,Text,SLCode
Label>Start
Let>k=k+1
ReadLn>C:\CP_Macros\JohnW\Europe\eContract.txt,k,strLine
If>strLine=##EOF##,end
Separate>strLine,comma,eContract
If>{(%ShpName% = %eContract_1%) AND (%SLCode% = %eContract_2%)}
SetDialogProperty>BolDialog,SrvContract,Text,%eContract_3%
EndIf
Goto>Start
Label>end
END>GetContractNum
[/code]

[b]Data in text file eContracts.txt[/b]
BARNES,OOLU,AE095045
DIVE,APLU,EXPIRED
DIVE,HLCU,S9NSE129
DIVE,HJSC,EXPIRED
DIVE,MAEU,EXPIRED
DIVE,OOLU,AE105010
DLF,APLU,EXPIRED
DLF,EGLV,38611
DLF,HJSC,ANE28170
DLF,MAEU,387057
DLF,OOLU,AE095050
DNE,APLU,TA09/0146
DNE,CMDU,09-1242
DNE,EGLV,38612
DNE,HJSC,ANE101555
DNE,HLCU,S9NSE115
DNE,MAEU,457725
DNE,MOLU,5045311B10
DNE,OOLU,AE105030



[IMG]http://i53.tinypic.com/11snnyb.jpg[/IMG]
Thank you in advance for all your help
Gil

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Sep 15, 2011 2:57 pm

Looking at the jpg it appears that you have not set "comma" to ",". The value of variables "strline" and "eContract_1" are the same after a separate by "comma"

The error occurs because there is no variable "eContract_2".

gchichester
Pro Scripter
Posts: 132
Joined: Mon Dec 22, 2008 4:56 pm
Location: St Augustine FL

Post by gchichester » Thu Sep 15, 2011 5:36 pm

JRL,
Thanks for seeing the error of my ways!

Have a great day

Gil
Thank you in advance for all your help
Gil

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts