Started: 9/20/2018 8:49 AM
Picture: Mike Odeh
Mike Odeh
Repeater Script - generateRepeaterRowValues

​Hi, I am programming a repeater to be populated from a lookup control. It works when I do not pass any parameters; however, when I do program the form to pass parameters I get a syntax error. I was wondering if anyone could look at my code and see if there is something I am missing as far as syntax goes. Thanks for your help!

generateRepeaterRowValues(Repeater2,'https://Domain/SC/Site','list',
'<Query><Where><Eq><FieldRef Name='Proposal' /><Value Type='Text' >'+ getValue(Proposal)
+'</Value></Eq></Where></Query>',
['Proposal','Proposal_x0020_Title','Experiment','Experiment_x0020_Title'],['P2','PTitle2','E2','ETitle2']);

Picture: Mike Odeh
  • Mike Odeh
http://www.itlaq.com:80/my/User%2520Photos/Profile%2520Pictures/mike_MThumb.jpg?t=63624568071" alt="Picture: Mike Odeh" />
Mike Odeh

​Hi, I am programming a repeater to be populated from a lookup control. It works when I do not pass any parameters; however, when I do program the form to pass parameters I get a syntax error. I was wondering if anyone could look at my code and see if there is something I am missing as far as syntax goes. Thanks for your help!

generateRepeaterRowValues(Repeater2,'https://Domain/SC/Site','list',
'<Query><Where><Eq><FieldRef Name='Proposal' /><Value Type='Text' >'+ getValue(Proposal)
+'</Value></Eq></Where></Query>',
['Proposal','Proposal_x0020_Title','Experiment','Experiment_x0020_Title'],['P2','PTitle2','E2','ETitle2']);

19/20/2018 8:49 AM9/20/2018 8:49 AMNoCodes & Scripts
6.72216108834661
19/20/2018 8:47 AM1
Jim Hidson
Posted: 9/23/2018 5:38 AM
Picture: Jim Hidson
Jim Hidson

I have checked your script and found it was missing the escape characters for the single quotes, please find below the correct code:

generateRepeaterRowValues(Repeater1,'https://Domain/SC/Site','List',
'<Query><Where><Eq><FieldRef Name=\'Proposal\' /><Value Type=\'Text\'
 >'+ getValue(Proposal)
+'</Value></Eq></Where></Query>',
['Proposal','Proposal_x0020_Title','Experiment','Experiment_x0020_Title'],['P2','PTitle2','E2','ETitle2']);

Name='Proposal' ----> Name=\'Proposal\'
Name='Text' ----> Type=\'Text\'

Note:-
If you are using lookup or dropDownList for the getValue() function then it will get you the value of the selection and not the selected text, so to get the selected text instead you can use this formula:
$('#Proposal').find(':selected').text()

generateRepeaterRowValues(Repeater1,'https://Domain/SC/Site','List',
'<Query><Where><Eq><FieldRef Name=\'Proposal\' /><Value Type=\'Text\'
 >'+ $('#Proposal').find(':selected').text()
+'</Value></Eq></Where></Query>',
['Proposal','Proposal_x0020_Title','Experiment','Experiment_x0020_Title'],['P2','PTitle2','E2','ETitle2']);


I hope this will help you to complete your form.

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

I have checked your script and found it was missing the escape characters for the single quotes, please find below the correct code:

generateRepeaterRowValues(Repeater1,'https://Domain/SC/Site','List',
'<Query><Where><Eq><FieldRef Name=\'Proposal\' /><Value Type=\'Text\'
 >'+ getValue(Proposal)
+'</Value></Eq></Where></Query>',
['Proposal','Proposal_x0020_Title','Experiment','Experiment_x0020_Title'],['P2','PTitle2','E2','ETitle2']);

Name='Proposal' ----> Name=\'Proposal\'
Name='Text' ----> Type=\'Text\'

Note:-
If you are using lookup or dropDownList for the getValue() function then it will get you the value of the selection and not the selected text, so to get the selected text instead you can use this formula:
$('#Proposal').find(':selected').text()

generateRepeaterRowValues(Repeater1,'https://Domain/SC/Site','List',
'<Query><Where><Eq><FieldRef Name=\'Proposal\' /><Value Type=\'Text\'
 >'+ $('#Proposal').find(':selected').text()
+'</Value></Eq></Where></Query>',
['Proposal','Proposal_x0020_Title','Experiment','Experiment_x0020_Title'],['P2','PTitle2','E2','ETitle2']);


I hope this will help you to complete your form.

Mike Odeh3509/23/2018 5:38 AM9/23/2018 5:38 AM
9/19/2018 7:49 AM