Without loop Create Factorial program

Hi All,

I want to create a Factorial program without any loop in outsystem.

when user enter any number and given output as Factorial series.

like when user enter 6-

output- 6*5*4*3*2*1 

Please advise


Thanks
Amogh

Hi Amogh,

Have tried any solution mean started with logic or not.


Regarda

Rahul

Hi Rahul,

I tried a solution with loop and its working but i want do it without any loop because loop is implement on  Record List Datatype .and when i use only single number it very difficult to convert single number in Record list using list append.


Regards

Amogh


Hello Amogh.

You are asking for a mathematical question in a technological forum.

Bring the algorithm you want implemented and we can do it in OutSystems.


If it is a trick question, you can do it without loops in OutSystems. You can use recursion in OutSystems. Or loops is .NET or JavaScript.

Solution

Hi Amogh,

You can do it by IF widget and need to use Mod function from BuilIn Function from Math Folder.

I have made one sample oml.

See demo


Hope this will help you.

Regards

Rahul Sahu

Solution

Hi Amogh,

One more solution for your requirement using Adhoc loop i.e IF element

See this sample app 

Find the attached .oml solution file


Regards,

Benjith Sam

Amogh Mishra wrote:

Hi Rahul,

I tried a solution with loop and its working but i want do it without any loop because loop is implement on  Record List Datatype .and when i use only single number it very difficult to convert single number in Record list using list append.


Regards

Amogh


 Hi Amogh,

i'm not sure I understand, but it sounds like you are trying to solve this with a ForEach  ?  Is this what you are calling a loop ??  Otherwise, what you are saying about needing a RecordList doesn't make any sense.


In that case I think it would be usefull for you to understand ad-hoc loops in Outsystems.  That is what Rahul and Benjith are using in their solution.  See this lesson for a shortcut.  (as it happens, they are also solving a math function with a loop)


But if I were you, I'd go with Nuno's suggestion, iterating down with recursion.  

Dorine