You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The $getHistoricalTags system function on the Scripts tab is not working properly.
To Reproduce
Steps to reproduce the behavior:
Go to 'Scripts'
Click on 'Any client script or create a new one'
Click on 'System Functions'
Click on 'getHistoricalTags'
Test Script
It won't work
Expected behavior
The expected behavior is the same as the $getTag, get the historical tag data on client script
I'm trying to load custom data on a chart to preview a few tags that were registered each hour once to display 24 registers on the chart (full day).
I have this script, but it seems that the $getHistoricalTags is not working on client, but $getTag works.
//const util = require('util');// Obtener el tiempo actual en milisegundoslettiempoActual=Date.now();letday=newDate().getDay();console.log(`El consumo total en el intervalo registrado es: ${tiempoActual}`);letnum=$getTag('t_9ab544e6-9b844ef9'/* FUXA - consumo_hora */);console.log(num);// Definir el tiempo de hace dos dias 172800000 hace un dia 86400000lethaceUnDia=tiempoActual-86400000;// Usar el intervalo desde hace una hora hasta el tiempo actualletvalores=$getHistoricalTags(['t_9ab544e6-9b844ef9'/* FUXA - consumo_hora */],haceUnDia,tiempoActual);//console.log(util.inspect(valores, {showHidden: false, depth: null, colors: false}))//console.log(valores['t_9ab544e6-9b844ef9' /* FUXA - consumo_hora */]);letvaloresY=valores['t_9ab544e6-9b844ef9'/* FUXA - consumo_hora */].map(item=>item.y);//console.log(util.inspect(valoresY, {showHidden: false, depth: null, colors: false}))varlines=[];varline={};constcount=24;vary=[];varx=[];for(vari=0;i<count;i++){//const randomNumber = Math.sin(i + parseInt(toAdd));// + Math.floor(Math.random() * 21);y.push(valoresY[i]);x.push(i);/*try{ let valor = valoresY[i]; if(valor){ console.log(`${i} : ${valor}`); y.push(30); }else{ console.log("ERROR PUSHING Y null"); console.log(`${i} : ${0}`); y.push(0); } }catch{ console.log("ERROR PUSHING Y"); y.push(0); } x.push(i); */}line['y']=y;line['x']=x;lines.push(line);$invokeObject('chart_1','setCustomValues',lines);
Screenshots
On the following screenshot you can see that I'm getting undefined. But when I try the function on server script works perfectly.
Environment
FUXA version: v1.2.0-1818
Node.js version: v18.20.3
npm version: 10.8.3
Platform/OS: Windows 11 Pro
Browser: Chrome
The text was updated successfully, but these errors were encountered:
Hi you have to put "await" before you use the $getHistorical
// Usar el intervalo desde hace una hora hasta el tiempo actual
let valores = await $getHistoricalTags(['t_9ab544e6-9b844ef9' /* FUXA - consumo_hora */], haceUnDia, tiempoActual);
Describe the bug
The $getHistoricalTags system function on the Scripts tab is not working properly.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The expected behavior is the same as the $getTag, get the historical tag data on client script
I'm trying to load custom data on a chart to preview a few tags that were registered each hour once to display 24 registers on the chart (full day).
I have this script, but it seems that the $getHistoricalTags is not working on client, but $getTag works.
Screenshots
On the following screenshot you can see that I'm getting undefined. But when I try the function on server script works perfectly.
Environment
The text was updated successfully, but these errors were encountered: