09.03.2023, 08:51
Hello All,
I am using 17 event scripts to get specific information from users for customer satisfaction in a system.
If the users set in a specific event it should register its value in a specific position in a CSV file. But I have two questions;
1- How can I write a script that will get input from an event and write it in a specific position in a CSV files
2- How can I write a script that will be able to calculate the total number of event input that was written into the CSV files
Thanks.
The event script is;
if grp.getvalue('1/1/134') == true then
grp.write('13/2/6',true)
grp.write('1/1/147',grp.getvalue('1/1/147')+1)
grp.write('1/1/158',grp.getvalue('1/1/158')+1)
---------------- script alarme intrusion ----------------
os.execute('mkdir -p /home/ftp/Rapport_SatCl/Jour')
---------------writing to file--------------------------------
local pile = io.open('/home/ftp/Rapport_SatCl/Jour/Rapport_SatCl_Jour_'..os.date('%d%B%Y')..'.csv',"a")
pile:write(os.date('%d/%m/%Y').." "..tostring(os.date('%H:%M:%S'))) pile:write(";")
pile:write(";")
pile:write("1")
pile:close()
end
I am using 17 event scripts to get specific information from users for customer satisfaction in a system.
If the users set in a specific event it should register its value in a specific position in a CSV file. But I have two questions;
1- How can I write a script that will get input from an event and write it in a specific position in a CSV files
2- How can I write a script that will be able to calculate the total number of event input that was written into the CSV files
Thanks.
The event script is;
if grp.getvalue('1/1/134') == true then
grp.write('13/2/6',true)
grp.write('1/1/147',grp.getvalue('1/1/147')+1)
grp.write('1/1/158',grp.getvalue('1/1/158')+1)
---------------- script alarme intrusion ----------------
os.execute('mkdir -p /home/ftp/Rapport_SatCl/Jour')
---------------writing to file--------------------------------
local pile = io.open('/home/ftp/Rapport_SatCl/Jour/Rapport_SatCl_Jour_'..os.date('%d%B%Y')..'.csv',"a")
pile:write(os.date('%d/%m/%Y').." "..tostring(os.date('%H:%M:%S'))) pile:write(";")
pile:write(";")
pile:write("1")
pile:close()
end