Forum Discussion
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)
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.
- BillA60310 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
- BillA60310 years agoContributor
I figured this out so I am all set.
I got it working by dropping the desired action step on top of the If...Then statement.
- Marsha_R10 years agoChampion Level 3
Ooh, I never heard of the "nothing" object. I will try it!
Here's an if then example done with "nothing" in the code expression inside the if.
- Marsha_R10 years agoChampion Level 3
- BillA60310 years agoContributor
I ended up changing my XLS test data to use the text 'None' instead of an empty cell and then my If...Then was based on If variable Not Equal to 'None' to type the date string via Keys. No else condition. The Tab key step is below the If...Then so it always executes.
I just tried using Nothing instead, so my data file can have empty cells, but I get a type mismatch when the If statement tries to execute.
any ideas?
Related Content
- 3 months agoasantev2
- 3 years agoMarkSchofer
- 3 years agotestbogus
- 3 years agozokirsalomov
- 7 years agowdc
Recent Discussions
- 2 days agoMW_Didata