Forum Discussion

DenisMedvedev's avatar
DenisMedvedev
Contributor
10 years ago

How to get NameMapping object with This or Self keywords?

 

 

Precondition:

I have bellow elements ODT.Class  ElementActions with code

 

function SetValue(obj, text){
obj.Keys(text + "[Enter]")
}

 

And ODT.Data.Application.CustomerName element it has type of ElementActions class, so I can use  SetValue method

Also it has method GetObject with code

 

function CustomeTextField(){
return NameMapping.Sys.Orders.OrderForm.Group.Customer
}

 

My test:

function start (){

 

ODT.Data.Application.OrderScreen.CustomerName.SetValue(ODT.Data.Application.OrderScreen.CustomerName.GetObject(), "Text")
 }

Here will be useful to get object without repeating

ODT.Data.Application.OrderScreen.CustomerName.GetObject()

 code in signature, so my question is How can we do it?

 

I read some article about This or Self keywords, but I’m not sure that it can help me to deal with it (https://support.smartbear.com/viewarticle/72522/)

 

 

 

 

 

 

 

 

 

 

 

 

2 Replies

  • The bellow code with system SetText() method works fine

     

    ODT.Data.CustomerNameTextField.GetObject().SetText("Text")

     

    The question is how it works with system SetText() method?

     

    Will be glad to have any help.

    Thanks in advance, Denis  

    • DenisMedvedev's avatar
      DenisMedvedev
      Contributor

      seems like i need override SetText function with prototype?

      any ideas, guys?