I want to create a cognite function that will do lot of computations and finally attach the derived output to a timeseries. Is there some production-ready sample code snippet that can be shared to see how to attach a derived value from cognite function to a timseries?
Cognite functions

Best answer by HaydenH
Hi
Thanks for the inputs. Is it possible to perform the insertion inside a cognite function but not return any json as output and deploy the function?
I think Cognite fucntion expects to have a json output.
Are you referring to the output from the handle function in a Cognite Function? If so, this is more for status purposes. E.g., if your handle/function was successful you might have a dictionary returned as follows:
return {“status”: “success”, “message”: f“processed {len(total_data)} datapoints”}
This dictionary would then be viewable as a JSON from the Functions webpage in Fusion. Maybe if you were handling a failure you might also write something like:
return {“status”: “failure”, “message”: “no timeseries found”}
The functions referred to by
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.