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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Generated Thingpredictor-[Model Name]-AnalysisThing not working programmatically with service

Max3
6-Contributor

Generated Thingpredictor-[Model Name]-AnalysisThing not working programmatically with service

Hello,

we successfully generated a Thingpredictor-[Model Name]-AnalysisThingTemplate via the TW Analytics Manager.

Then we created a Thing from this ThingTemplate in Thingworx.

We have the following properties provided:

 

thing.png

 

If we manually add a new row in the data infotable it works and analytics executes an analysis job (also it generates a key id as you can see here):

infotable.png

 

But if we programmatically try to add a new row with a thingworx service it only adds a new row without the generation of a key and analysis job:

infotable2.png

var newRow = new Object();
newRow._Wert1 = 26;
newRow._Wert3 = 28;

me.data.AddRow(newRow);

What could cause such a behaviour?

Do we need to do some additional steps for this to work?

 

Thank you in advance,

Max

5 REPLIES 5
cmorfin
19-Tanzanite
(To:Max3)

Hi

 

Maybe this article can help:

https://www.ptc.com/en/support/article?n=CS277418

 

You can find it by searching the keywords  "ThingPredictor infotable" in our Knowledge Base.

Feel free to use it next time you face an issue, there is a lot of valuable information .

 

Hope this helps

Kind regards

Christophe

Max3
6-Contributor
(To:cmorfin)

Hello Christophe,

 

I looked into the link you provided me, thank you.

 

But it still doesn´t seem to work for me.

 

I created two services AddNewRow and SetInfotable:

lü2.png

 

lü.png

 

But it still doesn´t generate a key.

 

Can you give me an example how it should be done correctly?

 

Thank you,

Max

 

cmorfin
19-Tanzanite
(To:Max3)

Hi @Max3

 

Here is a solution that will work, taking the problem a bit differently.

 

1) Create a persistent property on the thing, named, let's say trigger

2) Create the Analysis Event in Analytics Manager to trigger on DataChange event for the property trigger

3) in your original code, simply increase the value of trigger

me.data.RemoveAllRows();
var newRow = new Object(); newRow._Wert1 = 26; newRow._Wert3 = 28; me.data.AddRow(newRow);
me.trigger = me.trigger+1;

 

This works well on my side, analysis jobs are being triggered and executed.

 

Hope this helps

Kind regards

Christophe

 

cmorfin
19-Tanzanite
(To:cmorfin)

Hi @Max3

 

I have made an update to https://www.ptc.com/en/support/article?n=CS277418 with a sample code that shows how to make it work through the info table directly without using the trigger property ... both solution are equally valid.

 

Kind regards

Christophe

slangley
23-Emerald II
(To:cmorfin)

Hi @Max3.

 

If the response provided by @cmorfin helped to solve your issue, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Thank you for using our community!

 

Regards.

 

--Sharon

Top Tags