Forum Discussion

meenakshiyadav1's avatar
meenakshiyadav1
Contributor
6 years ago
Solved

not able to assign value to ListView Object

I am working on xamarin form based ios app. I am using a keyword driven framework in which I am passing Alias Name, Keyword (Action to be performed) and test data from excel sheet. 

when I directly assign value to Alias name of the object in my script, it workes fine --

Aliases.Device.processQaA36020.ManageContactPopup.Frame.StackLayout.Grid.lvAccounts.TemplatedItems.Item(0).BindingContext.Role = "Test Role"   //It works fine and the value 'Test Role' is set in Role field

 

But when I pass the value through variable it does not work. e.g.

 

function InputListObj(TestObj,InData)  //Testobj  is Alias name of Object on screen  and InData has the string that needs to be set in the field.
{
var obj = eval(TestObj)

Obj = InData
Delay(1000)

}

 

Can anyone please let me how to get it work.

 

 

 

 

 

  • You say it "doesn't work".  Are there error messages? warnings? More information is needed.

    Generally, so long as the contents of your Excel sheet match the ACTUAL mapped full Alias path of the object, your code SHOULD work.  One possible suspicion is that if you're doing the eval on the PROPERTY (which is what you are showing in your first example) the "eval" is probably returning the value of the property and not the actual object property itself.

    Suggested edit.

     

    function InputListObj(TestObj,PropertyName, InData)  //Testobj  is Alias name of Object on screen, PropertyName is the desired property for which to set the value  and InData has the string that needs to be set in the field.
    {
    var obj = eval(TestObj)
    
    Obj[PropertyName] = InData
    Delay(1000)
    
    }

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    You say it "doesn't work".  Are there error messages? warnings? More information is needed.

    Generally, so long as the contents of your Excel sheet match the ACTUAL mapped full Alias path of the object, your code SHOULD work.  One possible suspicion is that if you're doing the eval on the PROPERTY (which is what you are showing in your first example) the "eval" is probably returning the value of the property and not the actual object property itself.

    Suggested edit.

     

    function InputListObj(TestObj,PropertyName, InData)  //Testobj  is Alias name of Object on screen, PropertyName is the desired property for which to set the value  and InData has the string that needs to be set in the field.
    {
    var obj = eval(TestObj)
    
    Obj[PropertyName] = InData
    Delay(1000)
    
    }