Forum Discussion

BillA603's avatar
BillA603
Contributor
11 years ago

Data-Driven Test. How to handle Tab to next control for fields that are blank

Hi,

 

New User here. I recorded a keyword test, then created a Data-Driven Loop. Right now just performing a few quick tests. Input data consists of client name and service begin and end dates, however, for some services a blank end date is acceptable. In that case, the script should just TAB to the next field.  The script simply enters the date in mmddyyyy format as text. Cell in XLS is blank for no end date. Next script step is [Tab] to get to next control. The execution gets stuck at the End date field with Exception [Type Mismatch].

 

Maybe I need to use If/Else logic to check the End Date value and if Null, skip to next control. I tried but cannot figure out how to add/insert an If condition. Right-click Insert Operation only has If Object which expects an object.

 

Additional note:

In some cases a default end date is automatically filled in when Tabbing off Begin Date [auto-end-date]. In other cases End Date is left blank. depends on the service for the client. Both are possible and accepatable and need to be handled in addition to an actual end date in the xls. I think the [auto-end-date default] prevents us from just entering 00000000 for blanks, because sometimes that would blow away auto-generated End Date.

 

I am confused as to how to approach these things.

 

I appreciate any examples of handling empty data fields and how to insert conditional operations.

 

Thanks,

Bill

 

11 Replies

  • 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]")

     

    • BillA603's avatar
      BillA603
      Contributor

      Data:

      row 1 and row 3 run fine.

      row 2 test fails [blank end date].   

      SrvcBgnDt | SrvcEndDt

      -----------| ----------

      01012015 | 03312015

      01152015 |

      02022015 | 05312015

      • Marsha_R's avatar
        Marsha_R
        Icon for Champion Level 3 rankChampion 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)