0

I'm writing XP-VAPI scripts in HP ALM and some objects of the OTA-API use a construct which looks like this:

object.Field('nameOfField') = newValue;

Obviously this is not valid in Javascript. But because I use an IDE that checks the syntax according to ECMA standards this is shown as a syntax error. So I wonder is there a way to do this assignment with a proper Javascript syntax? I tried the following variants with no success:

CurrentRun.Field("RN_USER_13").value = 'pfusch';
CurrentRun.Field.RN_USER_13 = 'pfusch';
CurrentRun.Field["RN_USER_13"] = 'pfusch';
CurrentRun["RN_USER_13"] = 'pfusch';
CurrentRun.RN_USER_13 = 'pfusch';
AlvaHenrik
  • 404
  • 2
  • 10
  • What wasn't successful? What is the actual value of `CurrentRun`? – Scott Aug 03 '17 at 18:24
  • CurrentRun is an object with an expando property named 'RN_USER_13'. The problem is that the only way to set the value of this property is this horrible JScript syntax which is not allowed in Javascript. The funny thing is that Field() does not provide an object or a reference but just a read/write property. So the variants listed at the end were not successful in setting the value of this poperty. – AlvaHenrik Aug 03 '17 at 18:44
  • They do use such a construct? Wow! Please post an answer to [this question](https://stackoverflow.com/q/13124417/1048572) – Bergi Aug 06 '17 at 21:20
  • @AlvaHenrik What exactly is the problem? Your script seems to run in a jScript runtime where that format is allowed, so why are you trying to change it? – Bergi Aug 06 '17 at 21:23

0 Answers0