<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: RETURNED_PARAMETERS deep copy in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/RETURNED-PARAMETERS-deep-copy/m-p/225757#M3841</link>
    <description>&lt;BLOCKQUOTE&gt;Luke wrote:&lt;BR /&gt;
I can successfully call these macros into my main gsm using a CALL and obtain the relevant values using the RETURNED_PARAMETERS command. &lt;BR /&gt;
&lt;BR /&gt;
But... I cannot figure out how to make a 'deep copy' of the returned values which are all text string parameters. 
&lt;/BLOCKQUOTE&gt;

What do you mean by deep copy? GDL doesn't use references and pointers, everything is returned by value. &lt;BR /&gt;
Arrays can be copied with a single statement if their number of dimensions match. There is a trick here: macros can only return one-dimensional arrays. When a two-dimensional array is used in an end statement, it is converted ("flattened") two a one-dimensional array. If the caller object has to use it as two-dimensional, a for loop is needed to reconstruct the original array.</description>
    <pubDate>Mon, 30 Nov 2020 09:53:04 GMT</pubDate>
    <dc:creator>Peter Baksa</dc:creator>
    <dc:date>2020-11-30T09:53:04Z</dc:date>
    <item>
      <title>RETURNED_PARAMETERS deep copy</title>
      <link>https://community.graphisoft.com/t5/GDL/RETURNED-PARAMETERS-deep-copy/m-p/225755#M3839</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Here is the setup. I am trying to make a simple (2D text only) gsm which lists the consultants active on a specific project. I have created a subtype which has the relevant fields and have made several macros representing the different consultants. I can successfully call these macros into my main gsm using a CALL and obtain the relevant values using the RETURNED_PARAMETERS command. &lt;BR /&gt;&lt;BR /&gt;But... I cannot figure out how to make a 'deep copy' of the returned values which are all text string parameters. I cannot use the PUT command because these are strings. And if I store them in an array or as independent values they all revert to the current state of the consultant parameters.&lt;BR /&gt;&lt;BR /&gt;I could of course make a gigantic gsm with one parameter for every possible consultant and all relevant subfields. But this seems crazy when it would be so much easier to simply call some flexible number of consultants per project. &lt;BR /&gt;&lt;BR /&gt;Please advise whether this overall conceptual approach seems reasonable. If yes, is there something I am missing? If no, are there any resources covering this type of situation?&lt;BR /&gt;&lt;BR /&gt;Thanks, Luke&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Sep 2021 07:29:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/RETURNED-PARAMETERS-deep-copy/m-p/225755#M3839</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-15T07:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: RETURNED_PARAMETERS deep copy</title>
      <link>https://community.graphisoft.com/t5/GDL/RETURNED-PARAMETERS-deep-copy/m-p/225756#M3840</link>
      <description>I am a little confused as to exactly what you are trying to do.&lt;BR /&gt;
&lt;BR /&gt;
When you CALL an object, it will not be getting information from a placed object.&lt;BR /&gt;
It is simply CALLing the default object in the library with all of its default settings.&lt;BR /&gt;
&lt;BR /&gt;
So if you are placing individual objects for each consultant, there is no way for another object to to get values from the place consultant objects.&lt;BR /&gt;
Unless you want to delve into reading and writing to external text files, but that is a bit messy and does not always update instantly (you have to force a model re-build).&lt;BR /&gt;
&lt;BR /&gt;
Maybe what you want to do is place all of your consultant objects with all of their correct settings, and then schedule those objects, listing the parameters that you want to see?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
      <pubDate>Wed, 25 Nov 2020 02:26:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/RETURNED-PARAMETERS-deep-copy/m-p/225756#M3840</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2020-11-25T02:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: RETURNED_PARAMETERS deep copy</title>
      <link>https://community.graphisoft.com/t5/GDL/RETURNED-PARAMETERS-deep-copy/m-p/225757#M3841</link>
      <description>&lt;BLOCKQUOTE&gt;Luke wrote:&lt;BR /&gt;
I can successfully call these macros into my main gsm using a CALL and obtain the relevant values using the RETURNED_PARAMETERS command. &lt;BR /&gt;
&lt;BR /&gt;
But... I cannot figure out how to make a 'deep copy' of the returned values which are all text string parameters. 
&lt;/BLOCKQUOTE&gt;

What do you mean by deep copy? GDL doesn't use references and pointers, everything is returned by value. &lt;BR /&gt;
Arrays can be copied with a single statement if their number of dimensions match. There is a trick here: macros can only return one-dimensional arrays. When a two-dimensional array is used in an end statement, it is converted ("flattened") two a one-dimensional array. If the caller object has to use it as two-dimensional, a for loop is needed to reconstruct the original array.</description>
      <pubDate>Mon, 30 Nov 2020 09:53:04 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/RETURNED-PARAMETERS-deep-copy/m-p/225757#M3841</guid>
      <dc:creator>Peter Baksa</dc:creator>
      <dc:date>2020-11-30T09:53:04Z</dc:date>
    </item>
  </channel>
</rss>

