Hi everyone,
I'm new at programming using citect and I'm trying to do a simple programm in cicode where i have a device that resgisters values every two minutes and at midnight sends all the values and timestamps to a SQL table. I'm trying to retrive those values and times and display them on a trend but i can't seem to figure out how to create the trend.
This is the code that I'm using to pass the values from SQL to a Trend Tag and create a new trend.
TrnSetTable("Dados",StrToDate("27/03/2020")+StrToTime("12:23:00"),120,i,TrendTable,0);
TrnGetTable("Dados",StrToDate("27/03/2020")+StrToTime("12:23:00"),120,i,TrendTableRead[0],0);
TrnNew(20,"trn002","Dados","Teste_SQL");
All the values I get from the SQL are sucefully being writen in the TrendTable array, and I'm using the TrnGetTable function to see if the data is being transfered from the TrendTable array to the Trend Tag, which is not even though both functions are returning the correct value of samples written.
Also the TrnNew function returns 0 but doesn't seem to do anything which leeds me to think that there is something missing in the code, maybe I need to use other functions?
I have been searching everywhere and can't seem to find an answer and I'm getting kind of desperate can someone please help?
Thank you.
I'm new at programming using citect and I'm trying to do a simple programm in cicode where i have a device that resgisters values every two minutes and at midnight sends all the values and timestamps to a SQL table. I'm trying to retrive those values and times and display them on a trend but i can't seem to figure out how to create the trend.
This is the code that I'm using to pass the values from SQL to a Trend Tag and create a new trend.
TrnSetTable("Dados",StrToDate("27/03/2020")+StrToTime("12:23:00"),120,i,TrendTable,0);
TrnGetTable("Dados",StrToDate("27/03/2020")+StrToTime("12:23:00"),120,i,TrendTableRead[0],0);
TrnNew(20,"trn002","Dados","Teste_SQL");
All the values I get from the SQL are sucefully being writen in the TrendTable array, and I'm using the TrnGetTable function to see if the data is being transfered from the TrendTable array to the Trend Tag, which is not even though both functions are returning the correct value of samples written.
Also the TrnNew function returns 0 but doesn't seem to do anything which leeds me to think that there is something missing in the code, maybe I need to use other functions?
I have been searching everywhere and can't seem to find an answer and I'm getting kind of desperate can someone please help?
Thank you.