12 Replies Latest reply on Mar 24, 2012 9:55 AM by ian.moree

    Custom List Function explanation - Repeating Variable Name iter

    ian.moree

      Here is the code in question:

       

      $CLExecute[ iter ] = Case ( Left ( Substitute ( Lower ( Function ); ["definir"; "Let" ]; [" "; ""]; ["¶"; ""]); 5 ) = "Let([";

      Substitute ( First ; [ "_"; "Let([$CLn[" & iter & "]=$CLn[" & iter & "]+1;CLNum=$CLn[" & iter & "];" &

      Replace ( FunctionR; 1; Position ( FunctionR; "["; 1; 1 ); "" ) & "&¶&¶"] );

      Substitute ( First ; [ "_"; "Let([$CLn[" & iter & "]=$CLn[" & iter & "]+1;CLNum=$CLn[" & iter & "]];" & FunctionR & ")&¶&¶"] )

       

      So it looks like $CLExecute [ iter] is a repeating [variable], which i havent seen before.

       

      Just was wondering if $CLExecute [ iter ] will end being just a number or a word or a number or a calculation itself.

       

      trying to put in data viewer now, just looking for experts opinion!

       

      thanks again,

      -ian

       

      Message was edited by: ian.moree

        • 1. Re: New Calculation need an explanation PLEASE!!
          comment

          ian.moree wrote:

           

          So it looks like $CLExecute [ iter] is a repeating field variable, which i havent seen before.

           

          $CLExecute [ iter] is a script variable - not a field. iter is also a variable that needs to contain a number. All script and global variables are "repeating", i.e. their full name is $variableName[repetitionNumber]. You can omit the repetitionNumber when you refer to repetition #1.

          • 2. Re: New Calculation need an explanation PLEASE!!
            sporobolus

            on 2012-03-23 9:45 ian.moree wrote

            Here is the code in question:

            ...

            Just was wondering if $CLExecute will end being just a number or a word or a number or a calculation itself.

             

            first, it would behoove you to reformat such calcs with a good indentation scheme

             

            second, posing these puzzles without context makes it less attractive to help

            you with these analyses

            • 3. Re: New Calculation need an explanation PLEASE!!
              ian.moree

              Sorry Steve, but this is CustomList Function from BrianDunning site:

               

              http://www.briandunning.com/cf/868

               

              Here is the section in the Custom Function that i need help in understanding:

               

               

              $CLExecute[ iter ] = Case (

                             Left ( Substitute ( Lower ( Function ); ["definir"; "Let" ]; [" "; ""]; ["¶"; ""]); 5 ) = "Let([";

               

                                  Substitute (  First ; [ "_";  "Let([$CLn[" & iter & "]=$CLn[" & iter & "]+1;CLNum

               

                                  =$CLn[" & iter & "];" &   Replace ( FunctionR; 1; Position ( FunctionR; "["; 1; 1 ); "" ) & "&\¶&¶"] );

               

                                              Substitute ( First ; [ "_";  "Let([$CLn[" & iter & "]=$CLn[" & iter & "]+1;

               

                                  CLNum=$CLn[" & iter & "]];" & FunctionR & ")&\¶&¶"] ) );

               

                                       /*Final compilation starts here. The reminder part above each 1,700 values is treated now. */

               

                                        Final = Case ( X > 0; Substitute ( ( 10 ^ X ) - 1; 9; "Evaluate ( $CLExecute[" & iter & "] & $null ) & " ) ) &

                   

                                                    "Evaluate( LeftValues ( $CLExecute[" & iter & "] ; $CLRemainder[" & iter & "]  ) & $null ) & " & $null;

               

               

                                       /*The Final variable can now be evaluated to get our List*/

               

               

                                        Result  =   Case ( End <> "Error"; Substitute ( "#^#" & Evaluate  ( Final ) & "#^#";

               

                                                         [ "#^#|#^#"; "¶" ]; [ "¶"; "¶#^#" ]; [ "#^#¶"; "" ]; [ "¶#^#"; "¶" ]; [ "¶#^#"; "" ]; [ "#^#"; "" ] ) ) ;

               

                                        $CLExecute[ iter ]  = ""

               

              • 4. Re: New Calculation need an explanation PLEASE!!

                Hi Ian,

                 

                Could you please title your posts more appropriately related to the topic, something which might indicate the contents of your request?  This is best on any forum when one posts ... it helps others searching for same issues to quickly see if your topic might assist them.  In this instance, you might have named it something like:   "repeating field variable calculation".

                 

                I've seen people post with titles such as "What is this?" or "Please Help" or "I have a question" and it doesn't help others with a problem nor does it help those responding because they must read the post to know what it will be about.  Just an idea.  

                 

                Keep studying and asking questions!

                • 5. Re: New Calculation need an explanation PLEASE!!
                  ian.moree

                  i have done as best i think with topic heading. Any Better?

                  • 6. Re: New Calculation need an explanation PLEASE!!

                    ROCKIN'!! 

                     

                    UPDATE:  It didn't change all of the posts within the thread.  Me thinks this website isn't properly normalized, LOL or the title would be stored in only one place (the opening post).  Anyway, for future it will help anyway. 

                     

                    Message was edited by: LaRetta

                    • 7. Re: Custom List Function explanation - Repeating Variable Name [iter]
                      sporobolus

                      on 2012-03-23 11:13 ian.moree wrote

                       

                      Sorry Steve, but this is CustomList Function from BrianDunning site:

                       

                        http://www.briandunning.com/cf/868 http://www.briandunning.com/cf/868

                       

                      so the place to start to answer your question appears to be in the comment

                      before the relevant section of the code … you asked

                       

                      "Just was wondering if $CLExecute will end being just a number or a

                      word or a number or a calculation itself."

                       

                      and i would point out the comment above the code you excerpted, which says:

                       

                      "/*Each repeating variable content is parsed in order to get our String ready

                      for the last evaluation - Special care is made for

                      French users here, please substitute the "definir" below with your local

                      translation of the "Let" function if you're not using an english

                      version. The use of "Let ([" is recommanded anyway */"

                       

                      so $CLExecute (each repeat in the variable) will not end up being a

                      number or a word, it will be a string expression intended for the Evaluate()

                      function

                      • 8. Re: Custom List Function explanation - Repeating Variable Name [iter]
                        ian.moree

                        I am sorry, LaRetta is right about me and my vague questions. What i really want to know is WHY USE [iter] in the 1st place?

                         

                        As i am typing this ,  i am looking @ the code again for the 7th time. Looks like the green alphabet really! GEEZ .. one day i will laugh about all of this, but right now, headaches and advil!!!

                        -i

                        • 9. Re: Custom List Function explanation - Repeating Variable Name [iter]
                          sporobolus

                          and welcome to custom Jive email mangling!

                           

                          the last paragraph should begin

                           

                          "so $CLExecute [ iter ] (each repeat …"

                          • 10. Re: Custom List Function explanation - Repeating Variable Name [iter]
                            sporobolus

                            on 2012-03-23 12:06 ian.moree wrote

                            I am sorry, LaRetta is right about me and my vague questions. What i really want to know is WHY USE in the 1st place?

                             

                            the CF builds up a set of expressions (strings that will be evaluated), and

                            using a script variable with multiple repeats is a convenient way to do this; i

                            haven't analyzed the whole thing, but the "under the hood" note at the  bottom

                            of the function suggests that after building up the "array" of expressions in a

                            repeating variable, this variable is converted into what Agnès calls a "literal

                            chain", similar to the string that was evaluated in the other recent calc you

                            analyzed

                             

                            the very last comment has some good advice — have you tried it?

                            • 11. Re: Custom List Function explanation - Repeating Variable Name [iter]
                              ian.moree

                              Trying. Days and perhaps weeks to figure this out. AMAZING STUFF! i am glad i am not alone in thinking so. I just have to know how under the hood stuff works rather than just getting it to work.

                               

                              Have a great weekend. My head hurts for now..

                               

                               

                               

                              i

                              • 12. Re: New Calculation need an explanation PLEASE!!
                                ian.moree

                                More on this issue; Hope i am on right track

                                //Agnés AWESOME CALC>>

                                 

                                First = Substitute ( ( 10 ^ Calc ) - 1; 9; "__________" ) ; 

                                 

                                 

                                //Seems to be where the 1st get the result of the first "_"

                                GENIUS.

                                 

                                 

                                $CLExecute[ iter ] = Case (

                                                         Left ( Substitute ( Lower ( Function );

                                                                   ["definir"; "Let" ]; [" "; ""]; ["¶"; ""]); 5 ) = "Let([";

                                                    Substitute (  First ; [ "_"; 

                                                         "Let([$CLn[" & iter & "]=$CLn[" & iter & "]+1;CLNum=$CLn[" & iter & "];" &

                                 

                                 

                                // at least , thats what i think

                                // So you are substituting the "_" with Let([iter]=$Cln[iter]+1 ; else CLNum = $CLn[iter]) & more

                                 

                                 

                                ?? // DOES It look like i am on the right track