2 Replies Latest reply on Jul 15, 2013 12:00 PM by jsorge

    Passing Field Name to GetNthRecord

    jsorge

      I'm trying to create a calculation using GetNthRecord, and passing it a calculated field name. The problem is that it doesn't seem to like the field name that I'm passing it. Here's what I'm doing:

       

      Let ( [

       

      _idField = GetLayoutObjectAttribute ( "id" ; "source" )

       

      ] ;

       

      GetNthRecord ( _idField ; ( Get ( RecordNumber ) + 1 ) )

       

      )

       

       

       

      What gets returned instead (after an error 102) is the name of the field that it found in the LayoutObjectAttribute function. According to the documentation, the GetNthRecord function should be able to have a field name passed to it, which is exactly what's happening. I'm on 12.0.4 on OS X 10.8.4. Hopefully someone here has figured this out. Thanks!

      jared

        • 1. Re: Passing Field Name to GetNthRecord
          steve_ssh

          Hi Jared,

           

          If I recall correctly:

           

               -  GetLayoutObjectAttribute(  <ID>, "source" ) will be returning a string value.

           

               -  GetNthRecord expects an argument of a field reference.

           

           

           

           

          As such, I believe you'll have success if you modify your calc to something like:

           

              Let ( [

           

                _idField = GetLayoutObjectAttribute ( "id" ; "source" )

           

              ] ;

           

              GetNthRecord ( GetField( _idField ) ; ( Get ( RecordNumber ) + 1 ) )

           

              )

           

           

           

           

          That is:

           

            Simply wrap the returned field name in the GetField function.

           

           

           

          HTH and best,

           

          -steve

          • 2. Re: Passing Field Name to GetNthRecord
            jsorge

            That did it, Steve. Thanks!

             

            I didn't even try that becaue I expect it to return the contents of the field, which I didn't think GetNthRecord was looking for. It was looking for a field name. Crazy docs.

             

            Thanks again for your help!!