cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Creating an Infotable programmatically with the Android SDK

pdahmen
1-Newbie

Creating an Infotable programmatically with the Android SDK

Hey everyone,

I am looking for a way to create an Infotable without the Thingworx annotations with the Android SDK.

I have been looking for it the documentation but couldnt find a fitting example.

Can anyone help me on this matter?

Regards

Philip

1 ACCEPTED SOLUTION

Accepted Solutions
billrei
5-Regular Member
(To:pdahmen)

Here is an example of creating an InfoTable with two rows in it from scratch.

Each row has two columns, a customername and a customer number.

Here is an example:

// This example builds an InfoTable with a customer name and number in it
InfoTable it = new InfoTable();

DataShapeDefinition itShape = new DataShapeDefinition();

itShape.addFieldDefinition(new FieldDefinition("customername", BaseTypes.STRING));

itShape.addFieldDefinition(new FieldDefinition("invoicenumber", BaseTypes.NUMBER));

it.setDataShape(itShape);

ValueCollection itRow1 = new ValueCollection();

itRow1.put("customername", new StringPrimitive("Customer 1"));

itRow1.put("invoicenumber", new NumberPrimitive(34215346));

it.addRow(itRow1);

ValueCollection itRow2 = new ValueCollection();

itRow2.put("customername",new StringPrimitive("Customer 2"));

itRow2.put("invoicenumber",new NumberPrimitive(34213336));

it.addRow(itRow2);

View solution in original post

1 REPLY 1
billrei
5-Regular Member
(To:pdahmen)

Here is an example of creating an InfoTable with two rows in it from scratch.

Each row has two columns, a customername and a customer number.

Here is an example:

// This example builds an InfoTable with a customer name and number in it
InfoTable it = new InfoTable();

DataShapeDefinition itShape = new DataShapeDefinition();

itShape.addFieldDefinition(new FieldDefinition("customername", BaseTypes.STRING));

itShape.addFieldDefinition(new FieldDefinition("invoicenumber", BaseTypes.NUMBER));

it.setDataShape(itShape);

ValueCollection itRow1 = new ValueCollection();

itRow1.put("customername", new StringPrimitive("Customer 1"));

itRow1.put("invoicenumber", new NumberPrimitive(34215346));

it.addRow(itRow1);

ValueCollection itRow2 = new ValueCollection();

itRow2.put("customername",new StringPrimitive("Customer 2"));

itRow2.put("invoicenumber",new NumberPrimitive(34213336));

it.addRow(itRow2);

Top Tags