Forum Discussion

Morgan's avatar
Morgan
Frequent Contributor
12 years ago

Case statement issue

Two things...



1)  I want to set tag = 8 and TC keeps erroring because it thinks the case statement for 'p' ends there...


Case p of


      'PasteTest':


       Launch;


       tag := 8; 



Basically in the case of where p = 'PasteTest', I want it to BOTH run the Launch routine and set tag = 8.  How do I do this?



2) This one is a little hard to explain but here goes... I have a paste procedure with a couple of variables that are called in.  Basically it opens up a specified worksheet (xls) and then selects a tab by the name specified.  It's title reads as follows :



     procedure InitializePaste(SheetName, TabName); 



I am going to use this procedure in a number of different subroutines.  However, the sheetname changes in a given routine where the tabname for the same routine will remain the same.  How best can I structure this?  I tried to call SheetName from another subroutine but TestComplete hated that (errored).  



Please let me know if that's totally unclear.  My usual resource at my company is no longer around.  



Thanks! 

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I'm assuming you're using DelphiScript in which case you need to do something like



    Case p of


          'PasteTest': begin


           Launch;


           tag := 8; 

           end;



    Since your case includes more than one line to be executed, you need to make sure you wrap it in a begin/end code block.



    I'm not sure of your other problem...  Could you paste sample code of what you're doing?