News:

  • October 17, 2026, 05:52:04 PM

Login with username, password and session length

Author Topic: Adding Fields to a UDT  (Read 8939 times)

Bolt

  • Hero Member
  • *****
  • Posts: 598
Adding Fields to a UDT
« on: April 19, 2021, 07:58:18 PM »
Is there an "easy" way to add fields to a UDT (at the "end") without loosing the data in the current memory block's fields?
I'm looking to avoid having to create a "backup" UDT with same field layout, MEMCOPY the old block to the new block, then edit the old UDT to add new fields, then use a LOOP to copy the relevant fields from the backup to the newly edited UDT.  That also requires quite a bit of downtime to do a few PROGRAM mode PLC writes.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3628
  • Darth Ladder
Re: Adding Fields to a UDT
« Reply #1 on: April 19, 2021, 11:06:55 PM »
I wonder how MIM would treat that scenario.  If you made an image, expanded the UDT, then copied the image back in, if the old data would end up in the right locations.

Also, always leave spare space in your UDT to hopefully avoid reinitializing.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3850
    • Host Engineering
Re: Adding Fields to a UDT
« Reply #2 on: April 20, 2021, 09:02:41 PM »
No easy way to do this.  From a Memory View, you can export the data to a .csv file, but there is no import mechanism for structures/structure fields.

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: Adding Fields to a UDT
« Reply #3 on: April 21, 2021, 12:30:45 PM »
From a Memory View, you can export the data to a .csv file

Umm, you just answered my question from 3 weeks ago!
https://forum.hosteng.com/index.php?topic=3354.0

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3850
    • Host Engineering
Re: Adding Fields to a UDT
« Reply #4 on: April 21, 2021, 01:32:17 PM »
Umm, you just answered my question from 3 weeks ago!
https://forum.hosteng.com/index.php?topic=3354.0

Sorry - I make assumptions that people expect the PLC to do everything, but Designer running on a PC/Laptop is just another tool in the toolbox that can accomplish many things that a standalone PLC can't do natively.