Default Value in repeating section (first row - why!!)


Badge +9

I have a very simple repeating section with some text values. I'm basically collecting some values on the initial form and saving them into list item fields. 

Then a task form gets created with that repeating section, all I want is that the fields in the repeating section gets auto-populated with default values from the data I'm collecting on the initial form. 

The funny thing, it is working fine when I add new line items in the repeating section, all default values that I want are in there. But just not the first line in the repeating section. 

I added the default value of each field to be populating from the list item field. I also changed the null display value to be populating from that list item field. Still can't get the first line to auto-populate the default value. 

Using SP/Nintex 2016 on prem.

Thoughts?!


15 replies

Userlevel 5
Badge +14

I think that I might understand what you're trying to say... kinda. 

Are you saying that you want to take the Repeating Section data from the form on List A, and then reuse that exact data in a Task Form? 

If that's the case then you simply need to pull the XML data from the Repeating Section on the Form on List A into a Workflow Variable, and then link the Repeating Section of your Task Form to the Workflow Variable in question. 

--------------

But because you're talking about adding new data and control defaults, I'm not sure if that is the scenario you're trying to describe. 

One 'gotcha' with Repeating Sections is that  any Item (List Item that is) that is being generated by an outside force (for instance, via a workflow), doesn't know what the default values are that you have set to the Nintex Form controls and just generates a 'correct' XML structure (for the repeating section) that doesn't have any values populated. 

Because of this, when you enter the form, the FIRST row will default to the BLANK values generated during the Item's Pre-Creation, and subsequent rows that have been added will default to the correct values based on the configuration of the Nintex Form Control. 

One way around this (for Task based Forms) would be to create a Multi-Line Text Workflow Variable, set the initial value to the Repeating Section XML with your desired default values included, and then link the target Task Form's Repeating Section to said Workflow Variable. 

Once you have completed the Task, that Workflow Variable will contain all of the values entered into the Repeating Section for said task and you parse to your heart's desire. 

For more information on parsing XML for repeating Sections see: 

Nintex Forms/Workflow - Parsing Repeating Section Data - Vadim Tabakman 

How to parse a repeating section xml with for each action? 

Populating Repeating Section Controls with List Data 

 

If this doesn't help, could you please describe in a bit more detail what it is you're looking to accomplish? 

Badge +9

Hi nmarples

re: Are you saying that you want to take the Repeating Section data from the form on List A, and then reuse that exact data in a Task Form? 

Nope, I only have one repeating section on the task form that I want it to auto populate the first line with some simple calculated fields that I get from the list A - not a repeating section.

So to explain more.. here is some screenshots: 

My main form is this:

It has a lookup where I auto populate some numbers and I save those numbers (connected them) into a list item field. 

214064_pastedImage_1.png

I save the department code 806 and division # 5 into two txt fields, divCode and deptCode... 

Then I create my task form which has the repeating section. That repeating section contains two unconnected text fields, however my whole repeating section is normally connected to a MLT field. 

I have defaulted the value to be my simple txt field that I collected from the main form.

214066_pastedImage_4.png

now my default values are showing completely fine on new lines. but not on the main first line that shows by default. I don't want the users to have to delete the first line and add a new line then those values will show!

214065_pastedImage_3.png

Does that explain it a bit!

Userlevel 5
Badge +14

Ah. Yeah, then the secondmost part of my post is what you're looking to do. Because the Item (A Task is technically just an Item that is on a 'Task List'... which we can just treat like a regular list) is being generated by a workflow, the Repeating Section information is essentially being generated as if it were blank. 

Default values only default TO their value if you are generating them IN REAL TIME, that is, if you're actually looking at them during the time of their creation. This happens when you create a New Item, but NOT when you are Editing an Item!!! In the case of a Repeating Section, adding a new row will CREATE a new set of fields which will abide by their defaults!

How to get around this? 

You'll need to create some generic Repeating Section XML, like...: 

<RepeaterData>
  <Version />
  <Items>
    <Item>
      <RS_Account type="System.String"></RS_Account>
      <RS_Division type="System.String"></RS_Division>
      <RS_Department type="System.String"></RS_Department>
      <RS_Activity type="System.String"></RS_Activity>
      <RS_Amount type="System.Double"></RS_Amount>
    </Item>   
  </Items>
</RepeaterData>

Note: This assumes that your controls have been NAMED as shown above (RS_Account, RS_Division, RS_Department, RS_Activity, RS_Amount). If you haven't named your controls, do so. If you use different name then you'll need to use whichever names you have setup as replacements for all of the examples I'm using!!!!

214072_pastedImage_17.png

and set it to a Workflow Variable: 

214067_pastedImage_4.png

Then you can use the Update XML Workflow Action to setup this generic XML to the way that you'd like it to display upon editing:

214070_pastedImage_12.png

(You'll notice that I have (2) Updates taking place, which can be accomplished by clicking on the Add XML Update link on in the configuration dialog:

214069_pastedImage_6.png

If you need to Query a list elsewhere to get the values of those two fields (Department and Division) then you can do that and set those to two Workflow Variables respectively. If not then you can just replace the example Workflow Variables I'm using (currentDivisionValue / currentDepartmentValue) with the List Item column data. 

Now that you have usable xml, you can target that in the task form. Open the Task Form containing your Repeating Section and set the 'Connected To' value to the Workflow Variable containing your XML: 

214071_pastedImage_16.png


Now the moment of truth! We should be able to see our values on the first row, and the "default" values on the next rows. 

Initial Loading of Task Form: 214073_pastedImage_18.png


Adding of Row: 
214074_pastedImage_19.png


this should put you in the right direction. 


Badge +9

Thanks ‌, I'll give it a shout sometime today and let you know. It sounds about right to me. 

I'm also having another issue...  I'm taking the mlt values and html-izing them to put them into my email They were all workgin fine until i started putting those default values... All fields that done't have default values such as the account and amount are showing fine in the html. I can send you some screenshots of that if that would help. 

Thanks again for jumping in to help with this.. much appreciated.

Userlevel 5
Badge +14

mlt values? 

The more screenshots the better!

I would also post any related material about how you are generating the html for your emails in question, and even any generated html that doesn't seem to be working. 


Badge +9

Hi again nmarples‌,

MLT == Multiple Line of Text field

So, what we are doing is we are querying the xml and getting the repeating section data before and after every task to show on the email being sent on the coming flexi-task. Also we are doing it again after the task so the next stage will have the most recent repeating section data, that's because the users can change the repeating sectio on the task before it moves on. 

Here is how the configuration is looking like:

214396_pastedImage_2.png

214395_pastedImage_1.png

214397_pastedImage_3.png

Where {itemproperty:Coding} is the Mutliple line of text field that is connected to the repeating section. 

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- transform repeating section from xml to html -->

<xsl:template match="/">

<xsl:apply-templates />

</xsl:template>

<xsl:template match="Items">

<table border="1" width="100%" style="border-collapse:collapse;background-color:#eee;border:1px solid;color:black;font-size:100%;font-family:arial,helvetica,sans-serif;">

<thead>

<tr>

<td>Account</td>

<td>Division</td>

<td>Department</td>

<td>Activity</td>

<td>Amount</td>

</tr>

</thead>

<tbody>

<xsl:apply-templates />

</tbody>

</table>

</xsl:template>

<xsl:template match="Item">

<tr>

<!-- field output order -->

<xsl:apply-templates select="Account" />

<xsl:apply-templates select="Division" />

<xsl:apply-templates select="Department" />

<xsl:apply-templates select="Activity" />

<xsl:apply-templates select="Amount" />

</tr>

</xsl:template>

<xsl:template match="Account">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Division">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Department">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Activity">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>

<xsl:template match="Amount">

<td>

<xsl:value-of select="." disable-output-escaping="yes"/> </td>

</xsl:template>


</xsl:stylesheet>

now, al the values that were manually keyed in are coming throught from one task to the other with no issues. But eh items that were defaulted are not coming through.... and I can't figure why? 

they were defaulted fine: 

214400_pastedImage_6.png

Added the rest of the info and submitted the task. 

214399_pastedImage_5.png

The following task came back as this!! Only the manually keyed in values are the ones that came through... why?

214398_pastedImage_4.png

Badge +9

‌, can you check this one out? 

Badge +9

Update: 

When I added the default values into the repeating section on the other task forms. They now came through. But the HTML is still not working... sad.png

Userlevel 6
Badge +15

Sorry ‌, I'm not sure on this one. I can try recreating in another enviro to see if I get the same behaviour?

Userlevel 5
Badge +14

Could you please also provide the output of your XML from the repeating section in question as well as the desired HTML that you believe it should be creating (after being transformed)? 

It's difficult to evaluate what's happening from the xslt alone and it seems like the xml inputs aren't what you want them to be if the output is getting messed up... but it's impossible to tell being that I don't have your environment happy.png 


Badge +9

The main problem is any values that are manually keyed in into the repeating section comes to the HTML on the email with no problem. 

The items that were defaulted in there are coming is blank. So the first row had the division and department with the default values, I added more data into the first row, and left those two with the default. then I added a new row and changed those values to new values and they came through. 

This table is what displays on the email. My issue is the two highlighted fields that were defaulted and came as blanks!

 

Account

Division

Department

Activity

Amount

12345

______

___________

first activity

30

09876

3

999

another

47

Userlevel 5
Badge +14

I have reread everything and might see where things are getting flubbed up. 

If you have followed the steps above in my first suggestion to pre-generate some XML inside of a workflow variable, which is then linked to Repeating Section control, then when you are using the Query XML Action (with the XSLT transformation), you should not point to the MLT Column of the task list, but the Workflow Variable associated to the Repeating Section on the Task Form proper. 

Perhaps we should just run a test to see what the xml output of that variable is directly. 

You have your MLT Workflow Variable setup: 

214425_pastedImage_2.png


You have your Task Form setup with a Repeating Section attached to the Workflow Variable: 

214426_pastedImage_1.png

You have your fields inside of that Repeating Section set up to match the fields of the XML (So: Input1 and Input2): 
214433_pastedImage_2.png

When the Task is created and you view it, you should see your default data (that you put into the initial XML stored in that Workflow Variable): 
214434_pastedImage_3.png

When we add more rows, we can fill them out however we want: 
214435_pastedImage_4.png

And if we were to have set up a Send Notification Action after the Task Workflow Action like so: 

214436_pastedImage_5.png

Then after we Submit the Task with our added data, we should get the resulting XML back: 

<RepeaterData>
  <Version />
  <Items>
    <Item>
      <Input1 type="System.String">Fake</Input1>
      <Input2 type="System.String">Data</Input2>
    </Item>
    <Item>
      <Input1 type="System.String">More</Input1>
      <Input2 type="System.String">Silly</Input2>
    </Item>
    <Item>
      <Input1 type="System.String">Test</Input1>
      <Input2 type="System.String">Values</Input2>
    </Item>
  </Items>
</RepeaterData>

Our starting data is there, and our new data is there.

If you are not getting back similar results in your case, then we'll have to find the point at which it is breaking. Try recreating the above, and let's look at the resulting XML handed back to you. 


Badge +6

Hi Christine,

just a though, when you create the task form did you ensure your repeating section controls are named exactly the same as your controls in the initial form, if not your repeating section data will not pull through. controls MUST be named. 

Also your initial repeating section should be connected to a Multiple lines of text filed in your list, your task form repeating section should be connected to the same multiple lines of text field. I am working on something very similar with more complex data and all data pulling through. 

Badge +9

Hi Chantel Slabbert‌,

Yup, all my controls are named and my repeating section is connected to a multiple line of text.. It is just the funny thing is it brings some data and some not, that's what is confusing... and the ones that it is not bringing the data in are the ones that have default values. 

I'm not sure if that would be valuable but the ones not showing are of Integer/number type..

the others that are showing fine are single line of texts and currency.. 

Badge +9

Thanks ‌, I will give that a try this time... I do really appreciate your help on this.. 

On the initial issue, I was able to get it to work on the first row by changing the field type from text to integer and that magically did the trick, I don't know how, but it did it.. Apparently that still need some massaging for the HTML to show..  

Reply