Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
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?
Solved! Go to Solution.
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.
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?
I will try with that no specific use case just want to know whether it is possible or not.
Thanks
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.
Okay i will try with invoking Services for reading and writing entries.
Thanks
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.
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.
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.
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
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.
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...
Thank you for your response.
if you piece of java code to get and set the data , Can you share with me?
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.