Dynamically set visual elements properties

Dynamically set visual elements properties

  
Hi all!

Im designing a solution which can dynamically configure some of the atributes (Visible, Enabled Mandatory and DefaultValue) of my visual elements, accordingly with a service response.

My solution would be to identify the visual elements (containers, textbox, labels,etc) with an extended Property ("ConfigID") which would do the mapping to the service response.

In the preparation I would need to iterate through the visual tree to find the element with a specific ConfigID and then assign the properties.

Do you have any ideia how I can find an element by an extended property? Do you have better suggestions to this logic?

Thanks for the help!

Pedro Louro
not sure what you mean..

what you are suggesting is possible.
but why use extended-property?

are the elements based on a table?


Imagine that I have the following response from the service:

ID Visible Enabled Mandatory DefaultValue
1 Yes Yes Yes "Yes"
2 Yes No No "1 year"


I have to be able to do the mapping between the entries in the service response and my visual elements. So, my first ideia was to define an extended property in each visual element ("ConfigID") where I defined this "ID".

I have encountered some chalenges:

1) I could not understand how I can iterate in the visual tree
2) From the Preparation (or screen action), I am not able to set any other properties aside from "Valid" and "ValidationMessage"

So, I think my initial solution is just not suitable to OutSystems. Nevertheless, I saw that I could define the result of the properties (Visible/Enabled/Mandatory) as an expression - so I will now try to define an user action which receives the ConfigID and the desired property and returns the value.

I will keep you posted on the result. If you have any other suggestions from your experience, I welcome tips and suggestions!




I am still at a loss.

1. where do you define the elements to be placed on the screen?
2. when/where do you call the service? server/client?

a possible solution:
create a webblock that has an input widget and based on those value are visible.mandatory etc.

on the screen you get the list of elements, place them in a listrecord and  place the webblock in the listrecord.


1. I define the elements as in a "normal" page - in the screen. The ideia is that I have all the visual elements normally defined in OS, but I receive as input some of their parameters (visible, mandatory, etc)

2. Server.

I have sucessfully implemented this logic with an expression calling an Action passing an ID and the desired property which then parses all the config info and returns the target value.

Your proposed solution is also interesting, but it is what I call "100% dynamic" setting a huge depency from the service response (with the configurations). In the most extreme case, would be nice not to have any implementation in OS to add a new field in the screen - just by adding in the configuration.
The way I implemented it, I still have control on the visual definition (layout) and controling what is retrieved dynamically.