Forum Discussion
fyi: PowerBuilder app.
Script generated from Keyword Test [below]
The execution stops with Exception
Type Mismatch on the End Date step.
Note: I inserted line breaks in front of FNUD03110.... so code would not wrap
script:
' Enter the Bgn Date [mmddyyyy as text]
Call
Aliases.options.wndFNWND3110.MDIClient.wndFNWND311016.PBTabControl32_100.
FNUDO3110.pbdw110.PBEDIT110.Keys(Project.Variables.LtcTest1.Value("SrvcBgnDt"))
' Tab to next control
Call
Aliases.options.wndFNWND3110.MDIClient.wndFNWND311016.PBTabControl32_100.
FNUDO3110.pbdw110.PBEDIT110.Keys("[Tab]")
' This is where Exception gets thrown when End Date in XLS is blank
' Enter the End Date [mmddyyyy as text]
Call
Aliases.options.wndFNWND3110.MDIClient.wndFNWND311016.PBTabControl32_100.
FNUDO3110.pbdw110.PBEDIT1102.Keys(Project.Variables.LtcTest1.Value("SrvcEndDt"))
' Tab to next control
Call
Aliases.options.wndFNWND3110.MDIClient.wndFNWND311016.PBTabControl32_100.
FNUDO3110.pbdw110.PBEDIT1102.Keys("[Tab]")
Data:
row 1 and row 3 run fine.
row 2 test fails [blank end date].
SrvcBgnDt | SrvcEndDt
-----------| ----------
01012015 | 03312015
01152015 |
02022015 | 05312015
- Marsha_R11 years ago
Champion Level 3
Blank fields in Excel have never worked for us, no matter how we formatted the field. I suspect that there's hidden formatting that causes the type mismatch.
What we ended up doing was putting some never-to-be-used character in the "empty" field and then using If Then Else
If (ThingInExcel) does not equal (SpecialCharacter) Then
(put ThingInExcel in field)
Else
(tab past field)
- Andrey_M11 years agoContributor
Hi Marsha.
Have you tried nothing for empty field check?
In KDT it looks like
If Variables.excelData("Field2") Equals nothing
Log Message [...]
To define nothing in KDT: select Code Expression as value type to compare to and type nothing as piece of code.
This example is valid if VBS was chosen as scripting language.
null works for empty Excel fields if JS used for scripting.
- BillA60311 years agoContributor
Thanks for the replies. I like the If-Nothing suggestion but just not sure how to implement.
I just found the If...Then in the Operation panel and trying to implement now.
I am getting a runtime error: Object variable not set
Not sure if I am understanding the suggestion or coding the if/else correctly.
My end date value in the XLS is still blank.
Is Nothing a special condition or should I set my end date to the text "Nothing".
If (Project.Variables.LtcTest11.Value("SrvcEndDt") = Nothing) Then
Call Log.Message("End Date is blank", "")
Else
Call Log.Message("End Date is NOT blank", "")
Call Aliases.options.wndFNWND3110.MDIClient.wndFNWND311016.PBTabControl32_100.
FNUDO3110.pbdw110.PBEDIT1102.Keys(Project.Variables.LtcTest11.Value("SrvcEndDt"))
End If
-----------------------------------------------------------------------------------------
Below is a screen shot snippet of a Keyword Test immediately after Inserting If...Then.
I don't think I am doing it correctly because code is not indenting properly.
I appreciate any assistance as in what keyword script should look like and/or script generated from keyword.
Thanks