8
 Followers
70
 Likes

new / improved action tools

Service Studio
On our radar

What I like to see:

switch
to be able to set the labels of the conditions instead of seeing 1,2,3,4 and otherwise

do/while/do or  for-loop
I really would like to see a simple do/while on a condition, instead of a cumbersome if statement. the "cycle" note is a nifty feature with it.
wether is should be a for-loop with just an integer or a do/while I don't mind.
except for esthetics perhaps, because I don't like "breaking" out of a for-loop


Created on 21 May 2010
Comments (40)

Yeah, I agree an Do/While or For Loop would be good.

I would love to see perhaps even a Do CASE Statement:

DO CASE
     CASE <lCondition1>
        <statements>...
     [CASE <lCondition2>]
        <statements>...
     [OTHERWISE]
        <statements>...
     END[CASE]


Case could be possible with a switch but a do-while would be a great one!
When are we going to get these?

I've been asking for them since version 3.1 (or even earlier...)

Sure, most of the time the for-each loop works but sometimes the solution just looks wierd and would be *a lot* simpler -- read: lower maintenance -- with a for loop.

Merged from 'For loops' (idea created on 2010-06-08 10:28:46 by Carlos Fonseca), on 2010-07-08 16:26:14 by Paulo Tavares
Isn't this simlar to this idea https://www.outsystems.com/wisdomofthecrowds/IdeaComment_List.aspx?IdeaId=173 ?


Merged from 'For loops' (idea created on 2010-06-08 10:28:46 by Carlos Fonseca), on 2010-07-08 16:26:14 by Paulo Tavares
Right now I need to transverse a record list _backword_ and a "for each, backword" action tool would come very handy.
Or a "for-loop".
Merged this idea with 'While loop in Actions' (created on 2015-02-13 16:01:13 by Justin James)
Because using an If statement is an easy way to create an infinite loop by mistake.

J.Ja


Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James
yes, very much needed.



Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James
On that note, it's been proposed very often in similar matters

https://www.outsystems.com/ideas/173/new-improved-action-tools
https://www.outsystems.com/ideas/965/for
https://www.outsystems.com/ideas/730/enhanced-for-each
https://www.outsystems.com/ideas/1141/exit-loop
https://www.outsystems.com/ideas/776/add-break-continue-on-cycles
https://www.outsystems.com/ideas/289/detect-possible-infinite-loops-in-action-flows-and-force-the-definition-of-max-it


Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James
Sadly I suspect I posted at least a few of those...

J.Ja


Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James
The first idea (https://www.outsystems.com/ideas/173/new-improved-action-tools) has been proposed in 2010... how come it only has 16 likes (me included)?... Perhaps most outsystems developers don't feel the need of these tool action elements...
Indeed more tool action elements would leave the platform more expressive to code but also less "simpler".

I believe just the existence of a tool action element for a FOR loop, with a initialization, condition, and increment, would be suficient to handle most situations.

Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James
True,

imho, if you only create webpages and use sql propely there is almost no need for special for-loops.
However, when you are creating more batch-processing, converts and other BackOffice processes, the need for while-loops will increase.
In other words, it's the need for the 20% :)



Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James

Agreed



Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James

Yes, while should be present in actions



Merged from 'While loop in Actions' (idea created on 2015-02-13 16:01:13 by Justin James), on 2017-08-20 14:08:04 by Justin James

I know using a For Each widget covers the majority of cases where a loop-like behaviour is needed, and I have already used some kind of counter based systems with an if widget when I need to have an action do a cycle for some reason, but it always seemed a bit of a stretch to create a local variable, increment it and have it jump out the cycle when the iteration condition is met. 

is it possible to implement a while-like widget?

Regards,

Ângelo



Merged from 'Implement a "while-like" widget' (idea created on 2017-11-08 14:49:35 by Ângelo Sousa), on 2017-11-09 16:10:10 by Justin James

Isn't what you just described the typical implementation of a for-loop in any of the mainstream programming languages (PHP, C#, Java, JavaScript, Swift, etc...)?

The standard implementation of a "while" in any programming language isn't more than:

  1. If (condition) {
  2.   < implement your logic here >
  3.   go to 1.
  4. }

The main difference is in OutSystems you can see the "go to" (the loop!) visually as a connector back to the If tool...



Merged from 'Implement a "while-like" widget' (idea created on 2017-11-08 14:49:35 by Ângelo Sousa), on 2017-11-09 16:10:10 by Justin James

Hi Jorge

Yes I know that's what is behind a "while", which is why I was wondering if it is possible for OutSystems to implement a widget that does that logic in the background just like a ForEach does.  I realize this is nitpicking, but since the structure is always relatively the same (create a counter variable, insert if counter < end value, do the logic), I don't think it would be that hard



Merged from 'Implement a "while-like" widget' (idea created on 2017-11-08 14:49:35 by Ângelo Sousa), on 2017-11-09 16:10:10 by Justin James

Hey Joost,

The first idea is work in progress and it will be released soon (I'm tracking its progress with this idea: https://www.outsystems.com/ideas/4944/).

Regarding having do/while/do or  for-loop in the language we don't have short-term plans for this.

Should I rename this idea to include just the second part so that we can track them separately?

Cheers,

Merged this idea with 'For Loop' (created on 27 May 2018 10:54:12 by Ahmed Gad)

need to add "For loop", not a "For each loop" that loop till reach a specific number like

for (int i = 0; i < 10; i++)


This comment was:
- originally posted on idea 'For Loop' (created on 27 May 2018 by Ahmed Gad)
- merged to idea 'new / improved action tools' on 26 Oct 2018 15:35:15 by Tiago Leão

Hi,


Could you please eloborate it a but more?

For example, why would it be an advantage?

And would, for example, https://www.outsystems.com/ideas/173/new+%2f+improved+action+tools, a while-widget not be better?





This comment was:
- originally posted on idea 'For Loop' (created on 27 May 2018 by Ahmed Gad)
- merged to idea 'new / improved action tools' on 26 Oct 2018 15:35:15 by Tiago Leão

Changed the category to Builtin & User functions




This comment was:
- originally posted on idea 'For Loop' (created on 27 May 2018 by Ahmed Gad)
- merged to idea 'new / improved action tools' on 26 Oct 2018 15:35:15 by Tiago Leão

A For Loop is needed to repeat implementation of a piece of code for a specific number, although while loop is ok too



This comment was:
- originally posted on idea 'For Loop' (created on 27 May 2018 by Ahmed Gad)
- merged to idea 'new / improved action tools' on 26 Oct 2018 15:35:15 by Tiago Leão
Merged this idea with 'Loop Break' (created on 13 Mar 2018 16:26:04 by Victor Henrique Salvi)

Hello!

I think it will be very helpful to have a break tool to end the "for each" iteration.

Currently I iterate the list using the list index, but the agregate's pagination feature is lost with this method.


Thank you :D



This comment was:
- originally posted on idea 'Loop Break' (created on 13 Mar 2018 by Victor Henrique Salvi)
- merged to idea 'new / improved action tools' on 26 Oct 2018 15:37:33 by Tiago Leão

Changed the category to Builtin & User functions




This comment was:
- originally posted on idea 'Loop Break' (created on 13 Mar 2018 by Victor Henrique Salvi)
- merged to idea 'new / improved action tools' on 26 Oct 2018 15:37:33 by Tiago Leão
Merged this idea with 'For or While/DoWhile' (created on 20 Mar 2019 12:12:57 by Bernardo Condé)

Hello guys,

Currently the only loop we have is with For Each, which can only receive a list.

The idea then was to have a For that would generate a loop with a numeric condition, or While/DoWhile that generated a conditional loop.

It is often necessary to loop without a list, and we have to do with conditional if, which is not very practical.


Example:

For: for(initial value, boolean test, increment) {}

for(int count=1 ; count <= 10 ; count++) { 

        salary *= 100; 

} 


While: while (conditional) {}

while (salary < 5000) { 

         salary *= 100; 

}


DoWhile: do {} while (conditional)

do {

       increase += 50;

} while (increase < 500);



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Why is the if not practical? 

In high code languages it is impractical and thus do exists the for while and loop constructs. 

But with OutSystems low code visual coding it makes perfectly sense to use an if do something and connect back to the if.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Because the if often becomes impractical, confusing for a maintenance for example. If we had a For or While / DoWhile, this would greatly facilitate the development, and would make it cleaner. For the developer, it would be great to have something to use in your favor.

And I've also seen a lot of OS developers asking and saying what's needed.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Haven't encountered many scenarios till date where the if and foreach are not good enough to implement the logic. But no loss in having some extra options for sure. 



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

In Outsystems there is no difference between an IF and a WHILE loop.
With a for loop you could auto increment your value, but you can also facilitate this inside your if loop.

While I do agree that a for loop would be useful to create cleaner code (besides it can save you from defining a loop variable if you just want X iterations).

Looking back at some time ago, in a time where I was not using Outsystems, I would often create multiple elements to render on screen using a for(i=0; i < 10; i++){...} loop.
It could be useful for just filling a list for instance.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Yes I agree. Very helpful to all the developers, maintenance would be clearer, would help a lot.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Daniël Kuhlmann - "Why is the if not practical?"


An if that loops back on itself is fundamentally more equivalent to a goto than an explicit loop. This isn't a massive issue, but it certainly has visually messier code than the outsystems for-each.


Another thought on this suggestion however - it may be better if instead the platform introduces lazy-evaluated lists, i.e how you can do "for x in range(10)" in Python. This would be compatible with the existing list-based for loop by merely passing the "Record List" parameter as a "range()", and therefore not requiring an additional operator.


Although, this wouldn't resolve the while loop use-case.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Hi Thomas,

I see what you mean, but the big difference in OutSystems to highcode goto is that the loop is visual.

With Goto in some languages you can jump any where and there is no visual representation of the loop.

If you comment your label for the if as (while x < y, in stead of  if x < y ) you have all the semantics in your flow to understand what is going on.

Regards,

Daniel



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Hey Daniël,

Thanks for your thoughts and response.

I don't think visual coding really resolves goto's issues, aside from (implicitly) limiting the goto to pointing within the same function, which is the case in most programming languages regardless. 

Code that can arbitrarily jump backwards, and especially backwards into the middle of other loops or conditionals, is immensely dangerous and can be misleading.

In my opinion, the freedom of if statements in Outsystems often leads to very confusing and messy code, especially when working with other programmers. 

I'd really rather if the "if" statement was more like a true "if" and not a thinly veiled JNZ, such as by requiring the true case of the if to loop back into itself (like with the current foreach), but that has obvious backwards compatibility issues.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Hey Daniël,

Thanks for your thoughts and response.

I don't think visual coding really resolves goto's issues, aside from (implicitly) limiting the goto to pointing within the same function, which is the case in most programming languages regardless. 

Forwards-pointing gotos aren't so bad, but not necessary when we have exception handling. However, code that can arbitrarily jump backwards, and especially backwards into the middle of other loops or conditionals, is immensely dangerous and can be misleading.

In my opinion, the freedom of if statements in Outsystems often leads to very confusing and messy code, especially when working with other programmers.

I'd really rather if the "if" statement was more like a true "if" and not a thinly veiled JNZ, such as by requiring the true case of the if to loop back into itself (like with the current foreach), but that has obvious backwards compatibility issues.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Hey Thomas, 

You spoke one point I wanted, "the freedom of statements in Outsystems often leads to very confusing and messy code, especially when working with other programmers." 

Often an if for loop gets confusing, and for maintenance it does not get easy, hindering development.



This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira

Changed the category to Backend




This comment was:
- originally posted on idea 'For or While/DoWhile' (created on 20 Mar 2019 by Bernardo Condé)
- merged to idea 'new / improved action tools' on 04 Apr 2019 11:11:59 by Daniela Oliveira
views
2053
Followers
8