Forum Discussion
Creating a Recursive Function - Level Hard ? x = previous Y and Y = (a+x)/e
First of all thanks for your reply!
I read your article, but unfortunately, I still wasn't able to solve the problem ( maybe it's because I am not a mathematician, or an engineer ... and certainly not a pretty girl (pun intended only for those who read the link that Greg provide).
It would be very selfish of me to ask to you look at my code and point me in the right direction?
Just a little correction on the last part the "final" code was :
" This is the loop counter that says how my loops the function has to do to get the correct result for the specific line in my table ( i call this function on a custom column context)
clausula =
if contadoratual<=-1
then resultadoatual
else @loopPM(listaoper,listaestoque,listaquantidadenota,listapmnota,contadoratual,resultadoatual,resultadoatual,listaestoqueanterior)
in clausula
" ( in my previous post I wrote " in resultadoatual" but that was just me debugging..)
Maybe with some specific questions, I can get to the answer myself..:
1) From what I understand you are saying that I need to create 2 separate functions? Can I do that even if the result from each function needs the value from the other?
2) I could not find an if statement on your code to count the number of loops that the function is called. Can you enlight me?
3) I notice that you use the name "list" as a variable ?
list = {Text.From(startX) & "," & Text.From(startY)},
I thought that this was a reserved name. Any special reason that you did that?
Just this part gave the idea of creating a variable list to store all the "resultadoatual" ( read CurrentOutput) and then call the previous one in the calculations, but could not make that work...
4) Is there any problem that I am trying to use the function in a table on a custom column context??
I think I am missing a lot of knowledge of how the loops works..
In this simple example it appear to get the desire result
The simple code that I am referring to is this :
Thanks for all the help!!!
Hi felipecarvalho ,
You could use List.Generate() and create a function to realize it,check the vedio below:
https://www.youtube.com/watch?v=mXbjoSg9ldo
Best Regards,
Kelly
Did I answer your question? Mark my reply as a solution!