23
Views
6
Comments
Solved
How do make a deep copy of nested widgets e.g. a block containing blocks?

I need to  copy a nested structure of widgets where each widget gets copied (i.e. a deep copy).   A block containing sub blocks each containing a card (for example) .  Currently when I try this the sub blocks in the copy are just pointers back to the original (like a shallow copy).  Are deep copies of nested widgets possible?

Rank: #1122
Solution

Thanks for everyones responses on this and I appreciate your time.  But I'm closing this issue.

I have been looking at the issue further and the context of my question is not correct (I'm quite new to Outsystems) as things are not handled as I was thinking and I have got a solution using local variables and expressions.

FYI. Shallow and deep copies are terms from source code development where there are dynamic allocated resources as a part of a class instance and the class instance is copied.  The copy can contain either a pointer back to the allocated part (shallow - ie there is still only a single instance of the allocated part) or a full second instance of the allocated part (deep).   But I've worked out this doesn't apply here as its to do with the javascript building of the screen etc.

Rank: #68

Hi John, 

I couldn't understand your problem, can you show screenshots or a video of the problem?

Hi John,

I also didn't quite understand your question.

But would it have anything to do with using the webblock recursively? That depends more on your data models than the webblock itself. Perhaps this example can help you, if it is the case to use recursive webblocks.

https://www.outsystems.com/forge/component-overview/8075/exemplorecursivos

If you need help to understand it, you can contact me.

Rank: #295

Hi John,

Could you please explain your question in more detail?

Rank: #1122

I have 4 cards with text.  I have created a 4 column block and added each of the 4 cards to each column.  I would like to be able to copy the column block AND the contained cards in a single copy and paste.  

Currently this single step action leaves the cards in the new column block pointing to the original cards (shallow copy).  This means I need to copy each of the contained cards as additional actions.  What I would like is four new cards to be created also in this single copy and paste action (deep copy). 

Hope this helps.  Although from the answers above Im guessing a deep copy is not possible.

Rank: #128

Hi John,

please share some more detail or screen prints of what exactly you are doing.

AFAIK, copying something in Service Studio will be a deep copy.  For example, copying a widget with (several layers) of underlying widgets will copy everything in it.  That works when you do it in the widget tree, on the screen design, even copying between different screens...

For starters, what do you mean with 'block' ?  Are you talking about a webblock ?  If so, what do you mean by copy ?  An instance of the webblock on a given screen, and you try to put a copy of it on the same screen.  Or do you mean copying the webblock definition in the interface tree view to form an entirely different webblock ?

Also, what do you mean by shallow copy ?  Not sure I understand the "pointing to the original cards" bit ?  How can you tell ?





Rank: #1122
Solution

Thanks for everyones responses on this and I appreciate your time.  But I'm closing this issue.

I have been looking at the issue further and the context of my question is not correct (I'm quite new to Outsystems) as things are not handled as I was thinking and I have got a solution using local variables and expressions.

FYI. Shallow and deep copies are terms from source code development where there are dynamic allocated resources as a part of a class instance and the class instance is copied.  The copy can contain either a pointer back to the allocated part (shallow - ie there is still only a single instance of the allocated part) or a full second instance of the allocated part (deep).   But I've worked out this doesn't apply here as its to do with the javascript building of the screen etc.