Sequence Number in a sub form

Comments

4 comments

  • Avatar
    Karl Makatenas

    I don't know if this will suffice, but in the Configuration for the Subform control, you can show each entry's index:

  • Avatar
    Nik

    Is the purpose to give an index for the users (see Row Number above) or to create a unique ID for data storage?

  • Avatar
    David Foner

    Hi and thanks for the answers.  

    I guess that I need both... sorry for being greedy :)

    Mu situation is that I'm registering a complaint in a form and in a sub form I'm detailing the corrective actions which need to be taken . These corrective actions are then opened as separate tasks through a sub process and they have to be numbered, hence the need for the seq number.  
    The row number would be fine if I could use it in a formula to combine with the complaint number but I can't see this property listed anywhere.  

     

     

  • Avatar
    Karl Makatenas

    I threw together a bit of JavaScript back in the day to move the node containing the row number.  If you need to put just the row number in a field, you can probably skip the whole Show Row Number business and go straight to the jQuery indexing loop.  Here's a bit of untested code to start you on the right path.

    function AddRowNumberToField(thisField) {
      var index;
      for (var i = 0; i < thisField.parent().children().length; i++)
      {
        if (thisField === thisField.parent().children().eq(i))
        {
          index = i;
          break;
        }
      }

      var options = {fieldId: 'YourInternalFieldNameHere:[' + index + ']', value: index + 1};
      eFormHelper.setFieldValue(options, function(r){});
      }
    }

    Another options would be to ignore the indexing and re-create all row indexes on button click (add/remove/copy row).  I've had to use that a few times when I couldn't get the indexing to work.

Please sign in to leave a comment.