Output variables in WebBlocks

on 26 Sep 2018

That's about it.

Add output parameters in WebBlocks so you can reuse the data on parent screen or block.

Created on 10 May 2011
Comments (16)
I really don't get what you mean - a WebBlock is a screen element, so when do you want output? Also, what has that to do with reuse of data?
I get what he means with output parameters.
He wants to access variables / information inside a web-block.

Could be handy sometimes like when you have the same web-block 2 or 3 times in the same parent screen.
Yes, that´s what I mean, I want to pass a variable to a webBlock that can be accessed in the parent window.

In .net you have ascx controls with public properties, those properties you can "set" and "get" from parent windows (or parent controls for that matters)
In addition to what I've commented previously I just thought I posted another Idea that I hope it makes more sense for you Kilian.


Isn't a "NotifyWidget" action supposed to be able to pass values from a web block back to the parent?

There's only the Message parameter, so if you want to pass multiple values, you'll have to serialize them or the like. Quite a pain actually, but sometimes the only possibility. Also, if there's no button inside that triggers something, you have to do that on each OnChange. Feasible, but totally unnecessary if OS would implement a sane way to access the data inside the webblock (e.g. WebBlockName.WidgetName.DataElement).
Merged this idea with 'WebBlock - Output Parameter' (created on 2012-09-23 16:24:32 by enigma)
How about output parameters for web blocks?

This could help reusing upto single fields. And reduce bugs, ie. where accidently one attribute wasnt set in 2 out of 50 fields, which then lead to invalid inputs and ofcourse a big expedition to finding the two faulty fields.

ie. you have a date input field, which needs a special logic and is used accross all espaces.
Input field

You can create a webblock, with the input field and all required logic, preparation, actions, style etc

Have an input parameter, for the current or initial date and then the new output parameter, to return the changed value.
Date WebBlock

Now the webblock can be implemented in any form, to update the date in any table.
Example Form
(in this example, the date chunk is used for the date of birth. but it would also be any other date field, in other forms, from other tables)

Merged from 'WebBlock - Output Parameter' (idea created on 2012-09-23 16:24:32 by enigma), on 2016-10-25 13:01:17 by Goncalo Borrega
You can notify the parent page / web block using the "NotifyWidget" action and pass these values.

Merged from 'WebBlock - Output Parameter' (idea created on 2012-09-23 16:24:32 by enigma), on 2016-10-25 13:01:17 by Goncalo Borrega
Thank you very much for the hint! =)
But wouldnt you also preffer an output parameter?
For transparency, but also you wouldnt have to call an action for every such field in the form.

Merged from 'WebBlock - Output Parameter' (idea created on 2012-09-23 16:24:32 by enigma), on 2016-10-25 13:01:17 by Goncalo Borrega

Using OnNotify is such a pain ... That means for every onchange on a field you have to onNotify to the parent and the parent should handle the new changes. Like Kilian Mentioned.

It's really a pain when you have a page with global save, and some form parts are being reused on other pages.
Using OnNotify is almost impossible to maintain and keep the code simple and readable.

Using output parameters (for example of type record) would simplafly by alot this complexity.

Hi Niels. Have you checked the Event System component? It's meant to simplify reusing forms, global saves, validations and a lot more.

Merged this idea with 'Output Parameters for Web Block' (created on 01 Jul 2018 05:15:16 by Imelda Nugraha)

I understand that there is a way to pass data between Web Blocks and the main screen using OnNotify, but I think it will save time to have specific output parameters for Web Block instead of extracting (and converting) some values from single NotifyGetMessages with Text format.



Merged from 'Output Parameters for Web Block' (idea created on 01 Jul 2018 05:15:16 by Imelda Nugraha), on 02 Jul 2018 03:03:52 by Justin James

This should probably work like on mobile (i.e. events with parameters).

Changed the status to
on 26 Sep 2018

Hi Hugo,

That was indeed a common requirement. To overcome that need we implemented Events in web blocks in OutSystems 11. 

They work the same way as mobile block events introduced in 10: they allow you to send values to the parent screen or block using parameters (in a lot more explicit way than OnNotify, as you can specify several parameters with different data types). 

Thanks for your idea,
Tiago Simões