Solved TD-22456: Copy of UDV as value and not as reference

Missing or incomplete OpenText Gupta product features? Discuss it here!
Acclaro
Germany
Posts: 168
Joined: 16 Mar 2017, 08:13
Location: Hannover, Deutschland

TD-22456: Copy of UDV as value and not as reference

Post by Acclaro » 22 Apr 2015, 11:01

I' d like to have a function that copies UDV by value and not by reference as it is currently only possible.

Somethin like:
Set c_MyNewUDV1 = new c_MyoldUDV
Set c_MyNewUDV2 = new c_MyoldUDV

or even from an array
Set c_MyNewUDV1 = new c_MyoldUDV[ x ]
Set c_MyNewUDV2 = new c_MyoldUDV[ y ]

would save a lot of source code and execution time

thanks

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3483
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD-22456: Copy of UDV as value and not as reference

Post by Dave Rabelink » 22 Apr 2015, 11:46

Yeah, long time wish.

The only way now is to create a Copy function which "clones" the values:

Call uObjSrc.Copy( uObjDest )

So

+1
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Acclaro
Germany
Posts: 168
Joined: 16 Mar 2017, 08:13
Location: Hannover, Deutschland

Re: TD-22456: Copy of UDV as value and not as reference

Post by Acclaro » 23 Apr 2015, 07:32

Hello Dave,

I've seen your samples in the wiki with the copy function before.

By the way, thank you for the work that you do for all of us.

That's the way we must make it now.
But functional classes with subclasses and a lot of variables should be copied more comfortable.

Mike Vandine

Re: TD-22456: Copy of UDV as value and not as reference

Post by Mike Vandine » 29 Oct 2015, 07:51

Hi,

Yes, this is a long-time wish. An enhancement request was opened for this back in 2007 (TD-2765) and four years later the enhancement was rejected.

Sorry, but I don't think this one is going to happen. I can try again if you want with a new request, but I think the same thing will happen. :(

Best regards,

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3483
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD-22456: Copy of UDV as value and not as reference

Post by Dave Rabelink » 29 Oct 2015, 08:18

mvandine wrote:Hi,

Yes, this is a long-time wish. An enhancement request was opened for this back in 2007 (TD-2765) and four years later the enhancement was rejected.

Sorry, but I don't think this one is going to happen. I can try again if you want with a new request, but I think the same thing will happen. :(

Best regards,
Was there any reason given why this was rejected?

IMHO this would be a new feature which is very helpful. And probably even much more performant.
Instead of single copy all the attributes one by one (and forgetting to copy attributes as a cause of hard to find defects) an internal "clone" could to this much quicker.

For me, this feature would solve multiple wishes in one stroke:
- Easy development (no CopyFrom's anymore)
- Increased performance. Also a long time wish
- Avoid issues in code when attributes are forgotten

This enhancement is a +100k points from me.

I guess others here agree.

So the reason why this was rejected must be a very very good reason indeed.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Mike Vandine

Re: TD-22456: Copy of UDV as value and not as reference

Post by Mike Vandine » 29 Oct 2015, 08:48

Hi Dave,

OK, I will enter a new enhancement request for this and try to get it some high priority!

Thanks for the feedback. It is very useful.

Best regards,

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 1473
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: TD-22456: Copy of UDV as value and not as reference

Post by Igor Ivanovic » 29 Oct 2015, 16:15

You have my support for this.
Long time ago I've made a little CDK utility which generates the CopyFrom function for my functional classes.
It even has the logic to check for new variables and can create recursively the same function for every included udv, manage arrays, etc.

But the problem raises when I add a new variable and simply forget to regenerate the function, and here comes trouble.
I had problems because of it, that would simply not be there if we could do it in a simple native assignment.

Just my 2c.
Igor Ivanovic
Image

Mike Vandine

Re: TD-22456: Copy of UDV as value and not as reference

Post by Mike Vandine » 02 Nov 2015, 09:58

Hi all,

I have created TD-22456 for this enhancement.

Best regards,

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3483
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD-22456: Copy of UDV as value and not as reference

Post by Dave Rabelink » 20 Jun 2024, 11:33

This is an old thread. But just FYI.

SalObjCopy
bOk = SalObjCopy( objFrom, objTo )

This function copies the values of all instance variables from one UDV object to another.
Both variables must be declared with the same functional class.

Parameters:
objFrom: Reference. Reference to the source object whose class name is to be determined.
objTo: Reference. Reference to the destination object whose class name is to be determined.

Return Value:
Boolean. TRUE if successful, or FALSE if an error occurs.
Added in TD 7.4
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Return to “Enhancement suggestions”

Who is online

Users browsing this forum: [Ccbot] and 0 guests