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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Can we get datatable values from thingworx to java with Edge SDK without service

kborkar
12-Amethyst

Can we get datatable values from thingworx to java with Edge SDK without service

i have java code in which i have connected to thingworx through appkey and i want to access data table values without service is it possible to retrive values without services?

ACCEPTED SOLUTION

Accepted Solutions
ankigupta
12-Amethyst
(To:kborkar)

Hi Kedar Borkar​, It is not possible to read Data from DataTable without a Service. There are inbuilt Services in ThingWorx Platform to read and write entries from/to DataTable.

View solution in original post

12 REPLIES 12
supandey
19-Tanzanite
(To:kborkar)

Hi Kedar, you could test this by making a REST call from your Java code - though that will also use the service from the DataTable to get the values. Have you already tried that? Else any reason why you don't want to create a service for this? Any specific use case?

kborkar
12-Amethyst
(To:supandey)

I will try with that no specific use case just want to know whether it is possible or not.

Thanks

ankigupta
12-Amethyst
(To:kborkar)

Hi Kedar Borkar​, It is not possible to read Data from DataTable without a Service. There are inbuilt Services in ThingWorx Platform to read and write entries from/to DataTable.

kborkar
12-Amethyst
(To:ankigupta)

Okay i will try with invoking Services for reading and writing entries.

Thanks

kborkar
12-Amethyst
(To:ankigupta)

I have tried calling service for getDataTableEntries and updateDataTableEntries and i am able to get and set values through java edge sdk.

Thanks for immidiate responses.

gd11
1-Visitor
(To:kborkar)

Hi Kedar,

Can you tell me how you are writing services in java sdk? even i want to fetech the data entered from platform to java SDK.

Thank you.

kborkar
12-Amethyst
(To:gd11)

Hi Geetha D,

Sure. Actually we have created services in datatable's service tab in thingworx.

And we are using that services to get and set values through java.

below is the example by which you can call thingworx services from java.

client.invokeService(ThingworxEntityTypes.Things, "datatable1", "SetPingStatusDataTableEntries", value, 5000);

let me know if you still facing issue with that.

Thanks.

gd11
1-Visitor
(To:kborkar)

Hi Kedar,

Thank you for your response.

client.invokeService(ThingworxEntityTypes.Things, "datatable1", "SetPingStatusDataTableEntries", value, 5000); in this what it means "datatable1" "SetPingStatusDataTableEntries"?

and my requirement is I have created one mashup having textbox and button. when i enter some value in textbox  and hit button, that value i should get in JavaSDK.

If you have any idea can you please tell me the steps ASAP.

Thank you.

Geetha

gd11
1-Visitor
(To:gd11)

Hi Kedar,

Do you have any idea about how to call services from java SDK?

My requirement is I have created one mashup having textbox and button. when i enter some value in textbox  and hit button, that value i should get in JavaSDK.

kborkar
12-Amethyst
(To:gd11)

A quick question on your requirement:

After you click button why you need value in javaSDK?

I have not tried scenario like this, we have just set and get the values from data table and displayed it in thingworx through a java program logic.

And though if that is the requirement, i think you need to first save that value in data table through service and then you need to fetch from there. but i am not sure whether this will work for you or not. I don't have that much hands-on on thingworx.


May be Ankit Gupta​ can help you...

gd11
1-Visitor
(To:kborkar)

Thank you for your response.

if you piece of java code to get and set the data , Can you share with me?

kborkar
12-Amethyst
(To:gd11)

Hi Geetha D,

hi you can call service from java code once you have connected as below:

ValueCollection value = new ValueCollection();

value.SetStringValue("Status", status);

value.SetStringValue("RaspberryPiName", result.getRow(i).getStringValue("RaspberryPiName"));

client.invokeService(ThingworxEntityTypes.Things, "datatable1", "SetPingStatusDataTableEntries", value, 5000);

you need to create a value collection for input parameters and output parameters based on the service.

if you want to set value you need to create a input parameters and to get value you need to create a service with output parameters.

and to fetch value you can use below code:

ValueCollection params = new ValueCollection();

  params.put("maxItems", new IntegerPrimitive());

  //To read all the values from the Data table of Thingworx with service getDataTableEntries

  result = client.invokeService(ThingworxEntityTypes.Things, "datatable1", "getDataTableEntries", params, 5000);

Hope this will be helpful.

Thanks.

Announcements


Top Tags