Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hello,
I'm trying to create 8 things and bind them each to a different identifier. For the identifier I'm using a simulator which creates 8 identifiers which look like SN000i. (e.g SN0000 , SN0001...). </div><div>The problem is that the SetIdentifier() method is not working for me. I'm using TW 5.4 </div><div><br></div><div>Here is the code:</div><div><br></div><div><div>for( var i = 0 ; i<8; i)<br></div><div>{</div><div>var params = {</div><div> tags: undefined /* TAGS /,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>thingTemplateName: "RemoteThing" / THINGTEMPLATENAME /,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>description: undefined / STRING */,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>name: "Car"i /* STRING */
};
Resources["EntityServices"].CreateThing(params);
Things[params.name].EnableThing();
Things[params.name].RestartThing();
var ident= {
identifier : "SN000"+i
};
Things[params.name].SetIdentifier(ident);
Things[params.name].RestartThing();
}
When you check the Application or Script log, what errors do you see?
Sorry, I forgot to mention this. In the Script Log I don't see any error regarding this. The only thing which is visible after I create the things is in the Configuration log. Something like in the picture below.
015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_7 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_7 | |
2015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_6 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_6 | |
2015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_5 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_5 | |
2015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_4 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_4 | |
2015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_3 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_3 | |
2015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_2 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_2 | |
2015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_1 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_1 | |
2015-01-29 13:19:30 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = CREATE, reason = Thing CarThing_0 created programatically | Administrator | Thing | http-bio-80-exec-20 | CarThing_0 | |
2015-01-29 13:19:27 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = BEGIN_BLOCK_CHANGE | Administrator | Import | http-bio-80-exec-16 | BEGIN_BLOCK_CHANGE | |
2015-01-29 13:19:27 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = MODIFY, reason = services : CreateThings : Code Updated | Administrator | Thing | http-bio-80-exec-16 | UtilityThingCars | |
2015-01-29 13:19:27 | !http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon|style=margin: 0px; padding: 0px; border: none; vertical-align: middle;|src=http://localhost/Thingworx/MediaEntities/LogLevelInfoIcon! INFO | action = END_BLOCK_CHANGE |
The argument for SetIdentifier is misspelled as identifer (missing the last i) which may be your problem. However, I'm currently still using 5.3 SP1 so I haven't checked to see whether this was corrected in 5.4.
Thanks a lot Hugh! It works now. When I first tested the functionality I was using TW 5.2. Then I've upgraded to 5.4 and copied the code. It was not corrected in 5.4. It's still identifer, not identifier.