1 Reply Latest reply on Aug 26, 2013 11:00 AM by philmodjunk

    How to find value number, or line number??

    TonyTrevisonno

      Title

      How to find value number, or line number??

      Post

           I have a field with a bunch of values separated with carriage returns. Now, I click into the field with the curser on, say, value number 5. Is there some kind of calculation or script that I can run that can tell me that the curser is on value number 5?

           The end goal, is that I want to highlight the value in the field that I clicked on. Really, all I am looking for is the line number that the curser is on.

           There must be something obvious that I am missing – I hope….

           Thanks….

           TT

        • 1. Re: How to find value number, or line number??
          philmodjunk

               This can be done, but I must ask this key question: Are you sure you should have all these values in one field instead of a set of related records with one value in each record?

               Such a data model would greatly simplify what you are trying to do here.

                 
          •           Set Variable [ $Cursor; Value:Get ( ActiveSelectionStart ) ]
          •      
          •           Set Variable [ $Start; Value:Max ( Position ( YourTable::Field ; ¶ ; $cursor ; -1 ) + 1 ; 1 ) ]
          •      
          •           Set Variable [ $End; Value:Let ( E = Position ( YourTable::Field ; ¶ ; $cursor ; 1 ) ; E + not E * ( Length ( YourTable::Field ) + 1 ) ) ]
          •      
          •           Set Selection [YourTable::Field ; Start Position: $Start ; End Position: $End ]