Solved

How do I get the repeating section current row number in a NAC form?

  • 6 June 2023
  • 7 replies
  • 275 views

Userlevel 4
Badge +12

How do I get the current row for a repeating section in a NAC start form?

In Nintex for SharePoint on-premise we could use the runtime function of currentRowNumber.

I’ve tried with both a label and a number or text control and set the default value to a function but nothing matches that I can see.

 

Has anyone else found a solution?

 

What I’m trying to achieve is a repeating section with a drop down control for a selected activity. The form submitter can choose upto 5 but we would like to preference each row as 1st preference, 2nd preference or Preference 1; Preference 2, etc.

icon

Best answer by bsikes 7 June 2023, 15:28

View original

7 replies

Userlevel 4
Badge +12

in case there are no other solutions, I’ve just created an idea for this function to be added to NAC

Add currentRowNumber function to NAC forms | Nintex Ideas

Please up vote 👍

Userlevel 5
Badge +13

This post gets you part of the way there, but will only display the same total number of rows in each  row ID field in the repeating section.

365 Repeating section - how to capture each row number into the repeating section row | Community (nintex.com)

 

Userlevel 4
Badge +10

@Gavin-Adams  Just confirming, you’re looking for something like this?

 

Userlevel 4
Badge +12

@bsikes yes that is what I’m after.

Thanks,

Gavin

Userlevel 4
Badge +10

Here’s what the repeating section looks like:

The approach I went with is basically this:

  1. Use the convertToString function to convert the repeating section to a string.
  2. Use the replace function to remove everything after the current row from that string
  3. Use the replace function to remove everything from that string except a specific character that should only be present in each row once.
  4. Count the resulting string, which should correspond to the current row number.
"Preference " + 
convertToString(
length(
replace(replace(convertToString([Form].[Repeating section 1]),"(.*" + [Form].[Repeating section 1].[Current row].[GUIDLabel] + "\"}).*","$1"),".(?!UniqueRecord)","")
)
)

The trick with step 2 is that you need some way to identify what the current row is amongst the whole repeating section. I found that using the newGuidAsString() function accomplishes this well, in that it creates a unique value in a row, that you can reference from within the CurrentRow context. To do this, I have a form rule that when a new row is added, will set a hidden short-text field using this formula: "UniqueRecord" + newGuidAsString()

I’m then able to use a regular expression to remove everything after the current row, using the value from the current row’s GUIDLabel field to actually identify where that cutoff is.  The reason for me putting “UniqueRecord” in the field is for step 3.

 

In step 3, I remove any character that isn’t followed by “UniqueRecord”, which should give me a string that I can count the length of. 

 

Let me know if there’s any questions on that. It would be handy if there was just a built in variable for the CurrentRow context that could be referenced. 

Userlevel 4
Badge +12

wow @bsikes that’s some impressive function building.

 

A lot or work just to get the current row.

Really need Nintex to update NAC repeating section functionality to match what they have had in on-premise Nintex forms for over 10 years.

 

Userlevel 4
Badge +12

@marcusplatt just for your attention around adding a currentRow function to NAC forms.

Link to Nintex idea in the comments above.

Reply