Book a Demo

Author Topic: Creating and saving partitions through the API  (Read 3562 times)

sherey

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Creating and saving partitions through the API
« on: November 13, 2014, 04:28:29 am »
I am having trouble creating and saving partitions through the API.  I have a some code that is not generating errors but no partition is present when I open the project in EA.  I'm assuming I'm not saving the partition or owning collection or element right.

The code:

Code: [Select]
                   Set partPartition = elmTempElement.Partitions.AddNew("New Partition", "Partition")
                    elmTempElement.Partitions.Refresh
                    elmTempElement.Update


The typical algorithm requires the update method of the new element to be called, but I don't think there is an update method for a partition class.

What am I doing wrong?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Creating and saving partitions through the API
« Reply #1 on: November 13, 2014, 08:41:52 am »
EA is simply not consistent. Or consistent in its inconsistency.

Code: [Select]
part = activity.Partitions.AddNew ("p1", "");
part.Size = "90";
part = activity.Partitions.AddNew ("p2", "");
part.Size = "90";
activity.Update ();
(from my Scripting book)
This will create two partitions. Unlike others here you need to call update for the element itself.

q.