Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2012
    Posts
    15

    Clone record function and m2m relational fields

    When cloning a record, the copy's many to many relational fields does not
    contain the entries of the original, only the simple relational field
    contents are copied. Is there a way to solve this without resorting to
    a really slow running script?

    Thanks in advance for suggestions.

  2. #2
    Join Date
    Jul 2011
    Posts
    132
    Donot use the simple clone record. Instead write a script in the below process.

    Select the current record.
    Copy the individual field values to variable
    Create a new recod
    Apply the variables to each field of the new record

    In this way you have more control on your records.

  3. #3
    Join Date
    Oct 2012
    Posts
    15
    Quote Originally Posted by asokram View Post
    Donot use the simple clone record. Instead write a script in the below process.

    Select the current record.
    Copy the individual field values to variable
    Create a new recod
    Apply the variables to each field of the new record

    In this way you have more control on your records.

    Ok,

    I have created a script that asks for the number of copies to be created
    of a record, and then all fields of the selected record are stored in each own variable (The form has 22 simple rel.fields, 2 m2m rel.fields, and 13 text based fields). Then I have a FOR loop that creates all the new records, and I have
    a record set variable collecting all record numbers of the new records (BOOLEAN record set).

    Then I have another FOR loop which changes all the fields of the new records,
    based on the fields copied from the original record, and the record set variable
    created in the first FOR loop.

    It works, but its incredibly slow. Using the workplace version against the server, running this script, it seems to create the new records reasonably fast, but it takes more than 15 seconds (!) to change the fields of each record, even if Im operating on a record set.

    If I run the same script directly on the server, its much faster.
    Making 50 copies of the original record is done in about 30 seconds (still kinda slow though).

    Are there any tricks or tweaks to speed up the process, or do I have to live with the low speed? Duplicating records this slow is not usable at all.

  4. #4
    Join Date
    Oct 2012
    Posts
    15
    An update:

    I discovered that the server hardware Brilliant was running on, is heavily
    loaded, so I installed it on my desktop PC to test.

    It still needed 30 secs to copy 50 records when doing it in server,
    but now about 2min 15 secs from workplace, so at least that was an improvement.

    I then ran the optimize database tool, and now the operation takes no more
    than 6 seconds in server, and a few seconds faster in workplace.
    I have tried running workplace at my desktop, using loopback address towards
    server, and workplace on another machine, theres no difference, Im stuck
    at around 2 minutes.

    It seems that the network interface in Brilliant server is the main bottleneck here. As mentioned in the previous post, if anyone have any suggestions on
    how to improve this situation, please reply.

  5. #5
    Join Date
    Jul 2011
    Posts
    132
    You are right.
    Speed and stability over the network are the grey area in brilliant database.I hope this will be settled in the new release! !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •