Forum Discussion

royd's avatar
royd
Regular Contributor
9 years ago

Error trying to verify array value from another script unit [//USEUNIT] in current script unit.

I am using TestComplete v11,31,242 and Jscript. I have been using TC and Jscript about three months now. So my understanding is limited. I am creating modular script units for functions that are goin...
  • NisHera's avatar
    NisHera
    9 years ago

    you have declared var pStat [] globally (out side function)  which is OK

    but you are again declaring var pStat [] inside function so the program got confused...

     

    inside of function you do not need Var keyword 

    just do like 

    pStat = 
        [Aliases.browser.swce.aspnetForm.panelPatientInfo.Name.contentText, 
        Aliases.browser.swce.aspnetForm.panelPatientInfo.ptSource.contentText, 
        Aliases.browser.swce.aspnetForm.panelPatientInfo.acNum.contentText,  
        Aliases.browser.swce.aspnetForm.panelPatientInfo.MRN.contentText,
        Aliases.browser.swce.aspnetForm.panelPatientInfo.DOB.contentText,  
        Aliases.browser.swce.aspnetForm.panelPatientInfo.aDate.contentText,  
        Aliases.browser.swce.aspnetForm.panelPatientInfo.Dept.contentText,  
        Aliases.browser.swce.aspnetForm.panelPatientInfo.Group.contentText];  

    or better

    pStat[0] = Aliases.browser.....Name.contentText
    pStat[1] =Aliases....pt.Source.contentText
    
    
    

    pl type full-name instead of dots above

     

    Also a good place to grasp programming concepts is http://www.w3schools.com remember this is not jScrip TC have but most concepts are similer