Logic Machine Forum
ESF Import: Feature to Import (Update) only object name - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: ESF Import: Feature to Import (Update) only object name (/showthread.php?tid=1621)



ESF Import: Feature to Import (Update) only object name - manos@dynamitec - 02.10.2018

Hello All,

Is there any way to import the ESF file to the LM but only update the names? Because the objects exists into the LM if I try to import the new file, with some GAs names changed, the objects will be discarded. I have already imported the ESF and proceeded with the visualization so I want to avoid retagging them, redefining the datatypes and visu parameters.

Regards,


RE: ESF Import: Feature to Import (Update) only object name - admin - 03.10.2018

Enabled FTP server on LM, then upload data.esf to root directory (use ftp account). Then run this script once. ESF file will be deleted once this script runs.
Code:
data = io.readfile('/home/ftp/data.esf')

if data then
  lines = data:split('\n')

  for _, line in ipairs(lines) do
    props = line:split('\t')

    if #props >= 5 then
      addr = props[1]:match('[0-9]+/[0-9]+/[0-9]+$')

      if addr then
        name = props[2]:trim()
        id = buslib.encodega(addr)
        db:update('objects', { name = name }, { id = id })
      end
    end
  end

  os.remove('/home/ftp/data.esf')
end



RE: ESF Import: Feature to Import (Update) only object name - manos@dynamitec - 03.10.2018

(03.10.2018, 10:19)admin Wrote: Enabled FTP server on LM, then upload data.esf to root directory (use ftp account). Then run this script once. ESF file will be deleted once this script runs.
Code:
data = io.readfile('/home/ftp/data.esf')

if data then
 lines = data:split('\n')

 for _, line in ipairs(lines) do
   props = line:split('\t')

   if #props >= 5 then
     addr = props[1]:match('[0-9]+/[0-9]+/[0-9]+$')

     if addr then
       name = props[2]:trim()
       id = buslib.encodega(addr)
       db:update('objects', { name = name }, { id = id })
     end
   end
 end

 os.remove('/home/ftp/data.esf')
end

GREAT!!! Worked like a charm Smile 

Always giving solutions to us. Thank you again and again and again Admin...