Skip to main content
Jul 14, 2018 7:34 AM UTC
Question

Error: Unable To Convert From java.lang.String to INTEGER

 

Hello all,

 

When I try to create "INTEGER" property using extension it throwing error as "Unable To Convert From java.lang.String to INTEGER"

 

Below is my code:

   

String propertyname = "TEST";
String type = "INTEGER";
JSONObject remoteBindingAspects = new JSONObject();
thingname.AddPropertyDefinition(propertyname, "", type, "", "", false, true, false, "VALUE", (double) 0, false, "", (int) 3, "VALUE", (double) 0, "", remoteBindingAspects);

5 replies

Jul 17, 2018 12:02 PM UTC

Hi @Velkumar you need to ensure that you are working with ThingWorx BaseTypes, if you are looking to define a property of type Integer, it will be BaseTypes.INTEGER, e.g.

 

FieldDefinition Field1 = new FieldDefinition("Field1", BaseTypes.INTEGER);

VelkumarAuthor
Jul 18, 2018 6:45 AM UTC

Hello @supandey,

 

In our case datatype changes dynamically, how to overcome that.

 

Regards,

Velkumar R

Jul 18, 2018 7:06 AM UTC

Sorry i am not really sure what do you mean with datatype changes dynamically. If this is part of the infotable or datashape you can adapt that when creating them in runtime.