Hi,
i am sending data to Mariadb and its works fine using Node RED. Its pop up error in idea situation where no data been send. While the code end in else conditions the error message pop up. May I know how to over this error. ("Error: ER_EMPTY_QUERY: Query was empty")
Blockquotevar
status = context.get('status')||0;
var current = global.get("stdTime");
var daycurrent = global.get("stdDayTime");
var m_work_start = global.get('Mor_Shift_Start');
var m_work_end = global.get('Mor_Shift_Stop');
var n_work_start = global.get('Night_Shift_Start');
var n_work_end = global.get('Night_Shift_Stop');
/********************** Between Morning & Night Shift ********************************************/
//from night to morning
if (current > n_work_end && current < m_work_start) {
if(status === 0)
msg.topic ="INSERT INTO overalldata (deviceID, prdline, line, pulse, sumPulse, time, outputPin, STtarget, shiftTRGT, STActual, different, targetACHV, cycleTime, remarks) VALUES ('1', 'line 1', '1', '0', '0', '"+daycurrent+"', 'RESET', '0', '0', '0', '0', '0', '1', 'ok')";
status = 1;
context.set('status',status);
}
//from morning to night
else if (current < n_work_start && current > m_work_end) {
if(status === 0)
msg.topic ="INSERT INTO overalldata (deviceID, prdline, line, pulse, sumPulse, time, outputPin, STtarget, shiftTRGT, STActual, different, targetACHV, cycleTime, remarks) VALUES ('1', 'line 1', '1', '0', '0', '"+daycurrent+"', 'RESET', '0', '0', '0', '0', '0', '1', 'ok')";
status = 1;
context.set('status',status);
}
else{
status = 0;
context.set('status',status);
}
msg.payload = status;
return msg;
Blockquote