TD-22456: Copy of UDV as value and not as reference
TD-22456: Copy of UDV as value and not as reference
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
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
-
- Founder/Site Admin
- Posts: 3483
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Re: TD-22456: Copy of UDV as value and not as reference
Yeah, long time wish.
The only way now is to create a Copy function which "clones" the values:
Call uObjSrc.Copy( uObjDest )
So
+1
The only way now is to create a Copy function which "clones" the values:
Call uObjSrc.Copy( uObjDest )
So
+1
Regards,
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Re: TD-22456: Copy of UDV as value and not as reference
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.
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.
Re: TD-22456: Copy of UDV as value and not as reference
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,
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,
-
- Founder/Site Admin
- Posts: 3483
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Re: TD-22456: Copy of UDV as value and not as reference
Was there any reason given why this was rejected?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,
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
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Re: TD-22456: Copy of UDV as value and not as reference
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,
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,
Re: TD-22456: Copy of UDV as value and not as reference
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.
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
Re: TD-22456: Copy of UDV as value and not as reference
Hi all,
I have created TD-22456 for this enhancement.
Best regards,
I have created TD-22456 for this enhancement.
Best regards,
-
- Founder/Site Admin
- Posts: 3483
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Re: TD-22456: Copy of UDV as value and not as reference
This is an old thread. But just FYI.
Added in TD 7.4SalObjCopy
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.
Regards,
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Who is online
Users browsing this forum: [Ccbot] and 0 guests