4 Replies Latest reply on Jan 21, 2015 1:17 PM by contactmip

    How to report a value from one row to the next one

    contactmip

      Hello

       

      How can I report a value from one row to the next one in a portal?

       

      Example : Reporting value 38 in column 4 from row 1 to Row 2 (next row) in the 2nd column, value 30 to row 3 etc... in a calculated fied or in an auto-enter calculation option.

       

      NumberInitial ValueRateCalculated value
      15230%38
      23820%30
      33040%18
      etc.

       

      Thanks for your help

       

      M

        • 1. Re: How to report a value from one row to the next one
          jbrown

          Hi.

           

          I assume your workflow is like this:

           

          Record 1 value is entered as well as the percent.

          The calculation then happens

          Record 2 is created by user

          Record 2 initial value gets filled in automatically

          Record 2 calculation happens

          Record 3 gets created

          Record 3 initial value gets filled in automatically

           

          Is that correct?

           

          You probably would need to work with script triggers to grab the calculated value of the portal row record you are in and throw it in a global variable or global field. Then, in the initial value field, set another script trigger to fill in that field with the value in the global field / variable.  The global something would always have the calculated value of the LAST portal row you entered and calculated, except for the first, obviously.

           

          Here's another option.

          When you go to portal row 2 and create the record, you could use GetNthRecord function: GetNthRecord( CalculatedValue; Get ( ActivePortalRowNumber ) - 1).  You'd still have to put a script trigger on the Initial value field to run this function most likely.  You'd have to error trap to make sure you're not in the 1st row of the portal. The GetNthRecord function works on the related records that are found in the portal.

          • 2. Re: How to report a value from one row to the next one
            contactmip

            Hi Jeremy and thanks for your long reply.

             

            So, the second and all following lines are created time to time. I want to be sure that the reported value is done automatically not to allow any error. I quite new on this and do not apprehend how to transfer by script from one row to another. I wwould assume that the easiest way was to get the value while the new row is created, but It dont succeed in doing it.

            I've tried with a ExecuteSQL function. then with GetNthRecord() which seemed to be the good solution but still with no success...

            • 3. Re: How to report a value from one row to the next one
              jbrown

              Hi. I just edited my reply above with GetNthRecord.

               

              If you're in portal row 2, you want the value of the calculatedfield in the previous row. So you get the number of row you're on and use the function to get thevalue of the previous record (this portal row - 1).

               

              Note, that this function will not respect your sorts in the portal, but that should not be a problem in this case as you're entering one after another.

              • 4. Re: How to report a value from one row to the next one
                contactmip

                Yes thanks.

                I've just succeed by doing this :

                 

                GetNthRecord ( Calculated value ; Get(RecordNumber) -1 )

                 

                Many thanks to you

                1 of 1 people found this helpful