Is it possible to return a list from web-block to parent?

Is it possible to return a list from web-block to parent?

  

Is it possible to return a list from web-block to parent?

Hi Sekar,

Are you devoloping a web or mobile app? Which platform version?

HI Joao,

Web application  and Service studio version 10.0.609

Solution

On web apps you can pass a list to a web-block. All changes will be made on the original list (list won't be copied).

Solution

João Neves wrote:

On web apps you can pass a list to a web-block. All changes will be made on the original list (list won't be copied).

Thanks joao


João Neves wrote:

On web apps you can pass a list to a web-block. All changes will be made on the original list (list won't be copied).

Hi João,

Is it the same for mobile ?

I want to have some sortby features on my mobile app.

Example like this


No, in mobile you have events on web-block that allow you to pass information from the web-block to its parent.

Hi João,

Any example ? I only imagine it can be by using output parameter, but it seems there is output parameter in block.

Thanks in advance.

Add an event to the block and create an input parameter on that event. That input will allow you to pass information to the event handler.

Check out this for more information: https://www.outsystems.com/learn/lesson/807/blocks-and-events/

What is the reason why blocks and screens can't have output parameters? That seems very counter-intuitive. It also makes it unnecessarily complex to do simple things with blocks. 

Steve Sommers wrote:

What is the reason why blocks and screens can't have output parameters? That seems very counter-intuitive. It also makes it unnecessarily complex to do simple things with blocks. 

Steve -

I think everyone would *love* to see output parameters, but I think that the bottom layer technologies (JSF, ASPX) really would make that difficult. On the occasions I really need this, I REALLY NEED THIS. None of us like the workarounds. :(

J.Ja

Hi Steve,

For one thing, a Block isn't "called" like an Action, it lives as long as the page does. When would such an "output" parameter be available to the parent screen? How would the parent screen know the output is valid?

Kilian Hekhuis wrote:

Hi Steve,

For one thing, a Block isn't "called" like an Action, it lives as long as the page does. When would such an "output" parameter be available to the parent screen? How would the parent screen know the output is valid?

I would say that people want output parameters because they want in fact access to what is inside the web block...

Would be much easier, imho, if the operation was that the parent to have access to its building blocks.

In the end, the web block will be in the html file, inputs will be submitted in a post made in the page, etc.

This limitation (page can't see variables and actions in web blocks that are placed there)seems more like a concept enforcement than a real one. At least I would say that this would be possible in .net. Don't know about java, but I also think it would be possible.

But I understand that is much easier to keep simple and less error prone the way it is.

Don't get me wrong, I would love to be able to access the contents of Blocks, so we can use them for input as well (instead of just for display). It's just difficult to create a good conceptual framework for it...

Kilian Hekhuis wrote:

Don't get me wrong, I would love to be able to access the contents of Blocks, so we can use them for input as well (instead of just for display). It's just difficult to create a good conceptual framework for it...

I don't :)

While I "think" this is possible, and would make my life a lot easier in really many contexts, I understand not only the technical challenge it poses (if for nothing else to keep compatibility), and I see the problem of doing this in a way it keep coding less error prone and maintainable :)

To answer the original question, yes it is possible to pass a record list from webblock to parent. Using the Notify in combination with a JSONSerialize, you can pass the list as text. On the OnNotify in the parent, you can then use the NotifyGetMessage with a JSONDeserialize to revert the text back to your list.

Tim Timperman wrote:

To answer the original question, yes it is possible to pass a record list from webblock to parent. Using the Notify in combination with a JSONSerialize, you can pass the list as text. On the OnNotify in the parent, you can then use the NotifyGetMessage with a JSONDeserialize to revert the text back to your list.

I'm a bit of a newb at this could you give me an example of this technique? Possibly in an OML file?


João Neves wrote:

On web apps you can pass a list to a web-block. All changes will be made on the original list (list won't be copied).

Are you really sure? I've tried it and it seems not changing the data om the parent form is placed on..

Maby I'm doing someting wrong...


Martin,

Lists are passed by reference in the same eSpace only. Across eSpaces, the list is copied. Personally, I would never rely on this, because it's pretty invisible, and could break when refactoring an application by putting Web Blocks in a seperate eSpace...

You could change the recordlist to JSON and use a notify to the screen.

In the OnNotify on the screen parse the JSON back to the recordlist again.

You can use the JSON functions provide by the ardoJSON component.


If you need any help with this just let me know.

Johan den Ouden wrote:

You could change the recordlist to JSON and use a notify to the screen.

In the OnNotify on the screen parse the JSON back to the recordlist again.

You can use the JSON functions provide by the ardoJSON component.


If you need any help with this just let me know.

Hi Johan,

If you are using P10, you can use the standard (system) actions to serialize/deserialize to/from JSON.

Cheers,
Eduardo Jauch


I think they're actually "statements" on the right-side toolbar, instead of actions, but indeed, when you're on P10 use those instead of ardoJSON.

Oh...

I thought statements were like only the assignment, if, foreach, switch,...

Good to know that everything there is considered a statement.

Well, I'm not sure it's official terminology, but I've heard the things like if etc. referred to as "statement" in various training videos, and since the JSON Serialize/Deserialize is on par with e.g. Record List To Excel in that it's not a referenceable Action from System or some module, I think it's a good idea to call them that.