Skip to main content
19-Tanzanite
July 14, 2018
Question

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

  • July 14, 2018
  • 1 reply
  • 4646 views

 

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);

1 reply

5-Regular Member
July 17, 2018

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);

Velkumar19-TanzaniteAuthor
19-Tanzanite
July 18, 2018

Hello @supandey,

 

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

 

Regards,

Velkumar R

5-Regular Member
July 18, 2018

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.