Skip Ribbon Commands
Skip to main content
ITLAQ Technologies

Skip Navigation LinksDiscussions List : Ho to save repeater's rows in a different list
Use the Discussion list to hold forum-style conversations, including question and answer, on topics relevant to your team, project, or community.

Edited: 11/6/2017 1:26 PM
Picture: Sergio Schinoff
Sergio Schinoff
How to save repeater's rows in a different list?

​How could I save the repeater's rows in a different list using a custom button?

Picture: Sergio Schinoff
  • Sergio Schinoff
/my/User%2520Photos/Profile%2520Pictures/sergio_MThumb.jpg?t=63623640572" alt="Picture: Sergio Schinoff" />
Sergio Schinoff

​How could I save the repeater's rows in a different list using a custom button?

75311/6/2017 10:53 AM11/6/2017 1:26 PMNoCodes & Scripts
14.0867872280263
12/25/2017 7:28 PM
Edited: 11/6/2017 4:33 PM
Picture: Jim Hidson
Jim Hidson
You have two ways to do that:

 

The First Way)

By adding a custom button in the repeater row, in this button you can add a rule with type action event: onchange, and add the following script in it:

function addTheRow(){

var status=newListItem('/','Employee',['Title','EmpName','EmpNo','JobTitle'],[getValue(TextBox3),getValue(TextBox6),getValue(TextBox2),getValue(TextBox7)])

}

onClick(Button1,addTheRow())

 

The Second Way)

By adding a custom button outside the repeater to get all the rows data and save them in a list by looping through them. In order to do that follow the following steps:

Let's say you have four controls in the repeater [Title, Name, Num, Job]

  1. Create a [form variable] for each control [titleArray, nameArray, NumArray, JobArray]
  2. Add a rule on every control or put them together on one rule on the repetear with type action event: onchange with the following code:
    formVariableName=getRepeaterData(controlID)
    ie. titleArray= getRepeaterData(Title)
  3. In the custom button add a new rule with type action event: onchange with the following script:
function addAllRows(){

var titleArry=titleArray.split(',')

var nameArry=nameArray.split(',')

var NumArry=NumArray.split(',')

var JobArry=JobArray.split(',')

for(var i=0;i<titleArry.length;i++){

  var status=newListItem('/','Employee',['Title','EmpName','EmpNo','JobTitle'],[titleArry[i],nameArry[i],NumArry[i],JobArry[i]])

alert(status)

}

}

onClick(Button2,addAllRows())

 

This should do the job, take into consideration that alert(status) is to make sure that saving has been successfully done, you can replace it with if statement to show a custom success/fail messages.

 



Picture: Jim Hidson
  • Jim Hidson
/my/User%2520Photos/Profile%2520Pictures/jim_MThumb.jpg?t=63627189186" alt="Picture: Jim Hidson" />
Jim Hidson
You have two ways to do that:

 

The First Way)

By adding a custom button in the repeater row, in this button you can add a rule with type action event: onchange, and add the following script in it:

function addTheRow(){

var status=newListItem('/','Employee',['Title','EmpName','EmpNo','JobTitle'],[getValue(TextBox3),getValue(TextBox6),getValue(TextBox2),getValue(TextBox7)])

}

onClick(Button1,addTheRow())

 

The Second Way)

By adding a custom button outside the repeater to get all the rows data and save them in a list by looping through them. In order to do that follow the following steps:

Let's say you have four controls in the repeater [Title, Name, Num, Job]

  1. Create a [form variable] for each control [titleArray, nameArray, NumArray, JobArray]
  2. Add a rule on every control or put them together on one rule on the repetear with type action event: onchange with the following code:
    formVariableName=getRepeaterData(controlID)
    ie. titleArray= getRepeaterData(Title)
  3. In the custom button add a new rule with type action event: onchange with the following script:
function addAllRows(){

var titleArry=titleArray.split(',')

var nameArry=nameArray.split(',')

var NumArry=NumArray.split(',')

var JobArry=JobArray.split(',')

for(var i=0;i<titleArry.length;i++){

  var status=newListItem('/','Employee',['Title','EmpName','EmpNo','JobTitle'],[titleArry[i],nameArry[i],NumArry[i],JobArry[i]])

alert(status)

}

}

onClick(Button2,addAllRows())

 

This should do the job, take into consideration that alert(status) is to make sure that saving has been successfully done, you can replace it with if statement to show a custom success/fail messages.

 



Sergio Schinoff74011/6/2017 11:14 AM11/6/2017 4:33 PM
2/25/2017 5:38 PM1
Sergio Schinoff
Posted: 2/22/2018 3:08 PM
Picture: Dennis Mingeroet
Dennis Mingeroet

Hi Jim,
I have used this 2nd rule on several forms, and they work like a charm (off course).
One question I have on this topic is how we could manage to update  the repeater data afterwards without having the user to redirect to another form/list.  When I try it in the conventional way, I keep on running into rest-problems.


Thanks in advance

Picture: Dennis Mingeroet
  • Dennis Mingeroet
/my/User%2520Photos/Profile%2520Pictures/d_mingeroet_MThumb.jpg?t=63627087489" alt="Picture: Dennis Mingeroet" />
Dennis Mingeroet

Hi Jim,
I have used this 2nd rule on several forms, and they work like a charm (off course).
One question I have on this topic is how we could manage to update  the repeater data afterwards without having the user to redirect to another form/list.  When I try it in the conventional way, I keep on running into rest-problems.


Thanks in advance

Jim Hidson7502/22/2018 3:08 PM2/22/2018 3:08 PM
4/6/2017 5:55 PM
Posted: 2/22/2018 7:08 PM
Picture: Jim Hidson
Jim Hidson

Hi​ Dennis,

you could use the populateRepeaterFromList() function to do that, you could use the script manager to create the rule's script without the need to write any code.

Picture: Jim Hidson
  • Jim Hidson
/my/User%2520Photos/Profile%2520Pictures/jim_MThumb.jpg?t=63627189186" alt="Picture: Jim Hidson" />
Jim Hidson

Hi​ Dennis,

you could use the populateRepeaterFromList() function to do that, you could use the script manager to create the rule's script without the need to write any code.

Dennis Mingeroet8902/22/2018 7:08 PM2/22/2018 7:08 PM
2/25/2017 5:38 PM