4 Replies Latest reply on Feb 2, 2015 2:39 AM by ciprianote RSS
    ciprianote Explorer

    Programmatically adding things with identifier problem

    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&lt;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();