Forum Discussion

scot1967's avatar
scot1967
Frequent Contributor
5 years ago

JavaScript "ReferenceError: Invalid left-hand side in assignment"

I am trying to set a value in cell in a local table variable.  I have done this in C# but I can't make it work in JavaScript.  Nothing I have tried so far works....  It has to be something simple.  Thanks!!!

 

KeywordTests.Move_Order.Variables.VariableByName("tbl_QueryResults").SQLHeaderID(int_RowNumber) = 123456;

Or 

 var t = KeywordTests.Move_Order.Variables.VariableByName("tbl_QueryResults");
 t.Item(6,0) = 123456;

Or

 var t = KeywordTests.Move_Order.Variables.VariableByName("tbl_QueryResults");
 t.Item("SQLHeaderID",0) = 123456;

Or

 var t = KeywordTests.Move_Order.Variables.VariableByName("tbl_QueryResults");
 t.SQLHeaderID(0) = 123456;

PS...  Another variation...

  let t;
  t = KeywordTests.Move_Order.Variables.VariableByName("tbl_QueryResults");
  t.SQLHeaderID(0) = 123456;
  • scot1967's avatar
    scot1967
    5 years ago

    AlexKaras   Thanks, I could not get $set to work.  However,  aqObject.SetPropertyValue worked well.  

     

    // Get Ref to Table
    var t = KeywordTests.Move_Order.Variables.VariableByName("tbl_QueryResults");  
    //Write values to the KWT table  
    aqObject.SetPropertyValue(t, "SQLHeaderID", int_RowNumber, var_aSQLHeaderID)

    Here t is a reference to my table object, SQLHeaderID is the column name property, int_RowNumber is the, well, rownumber :smileyhappy: and var_aSQLHeaderID is the value I want to write to the local table in my keyword test.

     

    Thanks for all the help guys!