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

Custom logic required for Mean, Median , Mode and Standard Deviation

ranjank
14-Alexandrite

Custom logic required for Mean, Median , Mode and Standard Deviation

Hi Team,

 

Suppose we don't want to install the analytics on our server and want to write custom logic for mean , median , mode and standard deviation calculation on our Thingworx 9.1 portal itself..

 

Could you please help with the custom logic for all these so that we would become dependency free from analytics.

 

Thanks in advance.

4 REPLIES 4

I remember finding Mean, Median and Mode in a live data stream or data chuck is usually the interview question for CS students.  OOTB TWX side does not contain these functions, so apart from Platform analytics, you may need to write your own services in Extension (Resources-java) or custom scripts (javascript)

ranjank
14-Alexandrite
(To:zyuan1)

@zyuan1 

 

Please help in writing the custom logic in Javascript for dynamic size mean , median, mode and sd in thingworx itself.

The platform analytics is created for a reason.

 

1. The resource/ microservice size itself is in MB, and TWX script cannot handle very complex commands; 

2. the microservices is running independtly from the TWX server, since the infotable operation in TWX is costly and slow, and it will take away resources from other production services

 

You may try to migrate the sample codes online to TWX for a try

https://stackoverflow.com/questions/45309447/calculating-median-javascript 

slangley
23-Emerald II
(To:ranjank)

Hi @ranjank.

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags