Copy/Paste ER code loses variable references

Tony Z

Member
This may be just a limitation I have to live with, but I thought I would ask anyway: can you avoid losing variable references when copying ER code from one even to another?

E.g. when I want to move a pile of code from the "Do Section" event to the After Last Object Printed event, I can copy/paste OK, but even if I re-create the event variables with identical names, the copied code does not reference them correctly. It seems it still wants to refer to the OLD variables under the old ER (in fact one such instance would obstinately refuse to run until I removed the original (and now useless) variables from the original ER.

Is there a way to make this process less painful? I would even settle for an automated copy of all the event-level VA variables in preparation for the code copy...
 
Tony,

All of the following is from memory and may even refer to older versions of JDE - some may like to confirm.

Under the covers of the Event Rules each variable has a distinct id even if the name the developer sees is the same as another variable. I am guessing that you are copying ER that contains EVENT level variables. It is different (I think) if you copied ER containing REPORT level variables, the ER should be usable when pasted.

I hope this helps.
 
Like our Code CopyCat tool? ;-)

You probably want more flexibility, though...
 
that's one of the reasons i gave up using evt-level variables a loooong time ago. maybe not too elegant, but much less hassle when having to move code.

copying without a 3rd party tool (didn't even know there were any)? if memory serves me well: 1. change scope of the vars in question from evt to rpt; 2. go through your code, clicking all ER where the evt-vars are used (if-statements, table I/O, bsfn-calls, assignments, ...) to update the change if necessary (might require some re-mapping as well); 3. save & exit the ube (don't remember if this step is really necessary, but it certainly won't hurt); and then 4. move the code to the desired event.
 
Thanks for the responses. I *like* event-level vars, and it looks like the price of that is having to work through the copied code line by agonising line (or, to buy Alex P's copy tool). It is a real disappointment that something that would be a 5-second copy-paste in Notepad is turned into a 30-minute clickfest by the JDE tools.
smirk.gif


At least I know now that there is a 3rd party tool if the pain gets too much.
 
There is a similar problem with the Visual Compare tool that I had noticed in an 8.10 upgrade project. When using visual compare to copy code from one object to another, the tool displayed the changes. However, on going into the changed object, at times, the code did not exist or was blank (like a blank IF condition).

So it was back to the click fest - as you stated, to reconnect the missing code.
crazy.gif
 
Back
Top