Define variables within an expression

On our radar

I took inspiration from this idea


Basicly when I'm working on a page with a list and having to call a function to parse some data for each element in the list ( in this case the function returns a record) I have to recall the function over and over again, I'm pretty sure this is not cost efficient.

I would love to be able to do something like

DEFINE tempVar as MyList;
tempVar = MyFunctionWhichTakesInputsAndReturnsAList("I", "Want", "A", "List");
return (tempVar.FirstName + " " + tempVar.LastName + " : " + tempVar.Message);

Created on 27 Oct 2017
Comments (3)

I have no clue what the advantage would be..

either you solve it upfront in the aggregate or do it in a loop or in the screen.

afterall, it's just memory

Yeah that would mean I have to do an extra loop in my preparation to gather the data I need, create a different structure to combine both the list data and the extra attributes.

Compared to creating a temp variable in an expression.

It really sounds like you are asking for LINQ to be added to the system, or something like it.

I mean... no matter what, *something* is going to be looping over the list, even this function that you want to have added. It will never get "more efficient" unless it operates at a lower level (like LINQ does).

This is a request that would take a huge amount of effort for OutSystems to write in a fashion that is generic enough to be useful, and then it would be complicated. OutSystems made the deliberate decision to avoid things that look like delegates, callbacks, lambdas, and closures because they add a lot of complexity, create code patterns that less experienced developers struggle to understand, and are difficult to maintain; the pain they cause is more than the pain they solve.