Writing a manual List data structure

Writing a manual List data structure

  
I have a Web Block that essentially takes a list of text items and displays them on the page using the 'List Records' widget.  Because it uses this widget, this only works with aggregates that are pulling data from a database.

Instead of passing an aggegate, I would like to just supply a hard-coded list of things as an input parameter to my Web Block.  I don't want to store this data as an Entity, or in the database at all.  This would be analogous to padding a function an array in regular programming--I don't want to pass it a database result set, I just want to pass it an array of text strings.

Is there any way to simply write out the list of items (in an expression, for example) instead of having it pull from a database?

Thanks,
Mike
You can do it but why?  Just create a static entity (which is basically a hardcoded list) and use that whereever you need your hardcoded list.  If you really want a hardcoded list that is not in the databasee you'd have to create a structure and fill all the values in that structure for each list entry, probably in the preparation for any screen that needs it..  This seems like a lot of work.  Static entities were created for this exact use case.

Hope this helps,
Curt
Curt Raddatz wrote:
You can do it but why?  Just create a static entity (which is basically a hardcoded list) and use that whereever you need your hardcoded list.  If you really want a hardcoded list that is not in the databasee you'd have to create a structure and fill all the values in that structure for each list entry, probably in the preparation for any screen that needs it..  This seems like a lot of work.  Static entities were created for this exact use case.

Hope this helps,
Curt
 Thanks for your response.  How do I do what I highlighted in bold above? (my original question).

Additional question:  How would I do this with non-text values as well?  For example, if I wanted an array of buttons or containers.  What I want to do is have a Web Block that wraps around a menu.  The menu items (the array contents) are links that would have properties like Destination--I don't think I can model that as an entitiy.  (These are not menus in the sense of OutSystems menus, these are essentially context menus that change *a lot*, so don't get wrapped up in the notion of a menu being a menu)
 
There are ways to do everything you are asking about but (a) I would have to know a lot about what you are really trying to accomplish and (b) all the ways I can think of would likely be error prone and/or poor coding practices.

So, if you just want to write a list of items concatentaed in a string using expressions, you can certainly do that but then what?  What functionality are you trying to accomplish?  If the goal was better defined, instead of just an idea for creating this list, I and others could help more.

For the additional question, it's a similar problem.  There are several ways to create an array of buttons that I can think of.  If it changes a lot, why do you want to hard code it?  There are many ways of storing what you need and presenting them as links so that's not a problem. 

Sorry I can't be of more help.

Curt


I want to make a context menu that uses Bootstrap.  Because it would require several containers and widgets in OutSystems (to get the classes and HTML structure correct) I want to make this into a web block so users don't need to continuously copy over a complicated tree of widgets.

The contents of these context menus are not, and should not be stored in the database and they could change depending on what the user is doing or where they are (maybe the class on one label changes slightly, maybe the 'destination' changes a bit).  So my idea was to be able to drag an empty "context menu" Web Block and be able to give it a widget tree that contains the links for that specific context menu.

Wether or not there are other ways to do what I'm speficially asking is irrelevant, as is wether or not it should be put into a database.  I would like to know how to do this in general.

Is there any way to create a list that isn't tied to something in the database, or is there any way to supply a widget tree as an input parameter?  Either of these will solve my problem, but I'd like to know both as mentioned before.
Hi Michael,

You can define a strucuter that has the information you need and create an Input Parameter on that web block that is a List of this Structure data type. You can also use the built-in actions to create this list in memory instead of retrieving it from the database.