Ubidots Community

[SOLVED] Synthetic variable not working

I have a STEM account and have created a synthetic variable which performs a simple arithmetic calculaton using two “raw” variables. When I enter the formula it is accepted but does not show any values. If I change the synthetic to just contain the name of one of the raw variable then the synthetic shows that value. However as soon as I introduce another raw variable into the synthetic calculation then the synthetic doesn’t return anything.
If there a problem with synthetics currently ? Or is it not allowed to use more than one raw variable in a synthetic expression ?
I’ve even tried making the synthetic calculation a basic sum of the two raw variables but even that doesn’t work.


Hello @andywhit,
thank you for sharing your questions with the community.

Following up, please be aware that in order to operate 2 or more variables, they all must have the same timestamp, otherwise, the synthetic engine won’t know what values should be considered for the math.

For instance:

# | Var1 | Var2
1 | 2 | 3
2 | - | 10
3 | 5 | -
4 | 8 | 3
5 | - | 7

Please note that in the above data-series, only the 1st and 4th positions have all the data available to operate.

Now, in order to solve this issue, you should use the fill_missing() function, which is available from the IoT Entrepreneur plan and above.


Thanks for responding.
OK, here’s what I want to do, I’m not sure if it’s possible with my STEM account.

I have a device which publishes a value (lets call it “x”) to Ubidots every 15 minutes.
I want to show a value on a dashboard which represents a formula having two variables, “x” and a variable (“y”) which doesn’t come from a device but is set via a widget or manual entry component on the dashboard. “y” is typically only set once at the start of a period where the device is used (it’s used when brewing beer so won’t be continually in use). So “y” is sort of a constant but one I want to be able to modify via a UI rather than editing a formula and changing the constant value.

My first attempt was to create raw variables for “x” and “y”, a manual input widget to set “y” manually and a synthetic variable to perform the formula calculation involving “x” and “y”. However, this doesn’t work for the reason you mention.
Is there any alternative way I can represent “y” such that I can achieve my goal within my STEM account ?


Thanks for expanding your use case @andywhit.

Following up, the only available way to achieve your goal under the STEM account is setting the ‘y’ variable as a constant in the synthetic variable, since being able to edit it from Dashboard would require to operate using the fill_missing() function, which is not supported in the free version.


Ah OK, that’s what I was doing but wanted to move away from editing the synthetic for each brew.

Thanks anyway,