Blocks and Events training -  recussion question.
Discussion

Hi!
I'm currently going through training in Blocks and Events, and there's a question about blocks that I don't think is correct.

Here's the question: 

And I'm pretty sure my answer was correct, since I've tried it in the ServiceStudio, as you can see in the image below, there's 2 blocks one inside another:


Am I missing something?


Thank you:) 

mvp_badge
MVP

Hi Madara,

Not sure whether it's a bug in SS that allows this, but you indeed cannot put a Block inside itself. Since how would that work? You'd get an infinite number of repeating blocks, like a Droste effect.

mvp_badge
MVP

I tried, and this is what I get:

So it's definitely not possible.

EDIT: Got ninjad by Márcio :D.

No,

you cannot do this

EDIT: Always Kilian :D :D

Hi Madara,

what you are doing is not putting a webblock inside itself, it is putting an instance of a webblock inside the placeholder of another instance of that same webblock, on a given screen.

That is not recursion, and that is possible to do.  It will not lead to an infinite loop of block inside block, but just is still only 2 different instances of that webblock, who happen to be arranged one inside the other on a screen.

Dorine

Ok, sorry, it was my misunderstanding. What I did was trying to put a block inside itself, but on Screen. Not while defining the block itself. So I think that question should be more precise - since I can put a block inside itself (if the block has a placeholder) while using it on Screen. 

@Dorine Boudry - Exactly, sorry - I was writing my message while you posted your answer:) 

well,

what you need to understand, is that putting something in the placeholder of a block, really isn't putting it inside the block, the parent of that thing is still the screen, and not the block.  So for example, when your inner block on that screens fires an event, it will be the screen handling it, not the outer block.

mvp_badge
MVP

I understand the confusion. With a placeholder it's different, as you do not get the recursivity problem. I find the wording of the question unclear, even though placing a Block in a placeholder of a Block that's already inside a Screen could be considered "inside a Screen". I'll notify OutSystems about this, thanks for bringing it up.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.