Equivalent of StructKeyList() for struct value
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
StructKeyList()
will give me list of struct key with comma delimited. Now I need to get struct value with comma delimited. Right now this is what I'm doing to get value
<cfloop collection="#form#" item="key" >
#form[key]#,
</cfloop>
How can I get list of value from struct without loop? Thanks in advance.
forms coldfusion coldfusion-2016
|
show 5 more comments
StructKeyList()
will give me list of struct key with comma delimited. Now I need to get struct value with comma delimited. Right now this is what I'm doing to get value
<cfloop collection="#form#" item="key" >
#form[key]#,
</cfloop>
How can I get list of value from struct without loop? Thanks in advance.
forms coldfusion coldfusion-2016
2
If you know the name of your key, you can just pick off the value. Something likeform.myfieldname
. I don't understand why the loop is a problem.
– James A Mohler
Nov 16 '18 at 13:44
Also, what is your overall objective here? You're apparently iterating through a list of form fields, but why? There may be a better way to solve your bigger issue.
– Shawn
Nov 16 '18 at 19:17
@Shawn I have dynamic form data to insert with mysql. So I was wondering whether there is a function I could use directly with myinsert
query. Right now I'm working withINSERT INTO
student` ( #ListQualify(StructKeyList(form),"")# ) VALUES ( #ListQualify(val,"'")# ) ;
– sg552
Nov 16 '18 at 19:25
1
I'd be very careful about SQL injection with a scheme like that. It's not usually a good idea to insert data directly into a database from form values.
– Shawn
Nov 16 '18 at 19:32
By "dynamic form data", do you mean that you have a list of fields that may or may not be in your form submission, that the names of the fields are dynamically generated or something else?
– Shawn
Nov 16 '18 at 20:03
|
show 5 more comments
StructKeyList()
will give me list of struct key with comma delimited. Now I need to get struct value with comma delimited. Right now this is what I'm doing to get value
<cfloop collection="#form#" item="key" >
#form[key]#,
</cfloop>
How can I get list of value from struct without loop? Thanks in advance.
forms coldfusion coldfusion-2016
StructKeyList()
will give me list of struct key with comma delimited. Now I need to get struct value with comma delimited. Right now this is what I'm doing to get value
<cfloop collection="#form#" item="key" >
#form[key]#,
</cfloop>
How can I get list of value from struct without loop? Thanks in advance.
forms coldfusion coldfusion-2016
forms coldfusion coldfusion-2016
edited Nov 16 '18 at 13:45
James A Mohler
7,276123455
7,276123455
asked Nov 16 '18 at 13:41
sg552sg552
80931942
80931942
2
If you know the name of your key, you can just pick off the value. Something likeform.myfieldname
. I don't understand why the loop is a problem.
– James A Mohler
Nov 16 '18 at 13:44
Also, what is your overall objective here? You're apparently iterating through a list of form fields, but why? There may be a better way to solve your bigger issue.
– Shawn
Nov 16 '18 at 19:17
@Shawn I have dynamic form data to insert with mysql. So I was wondering whether there is a function I could use directly with myinsert
query. Right now I'm working withINSERT INTO
student` ( #ListQualify(StructKeyList(form),"")# ) VALUES ( #ListQualify(val,"'")# ) ;
– sg552
Nov 16 '18 at 19:25
1
I'd be very careful about SQL injection with a scheme like that. It's not usually a good idea to insert data directly into a database from form values.
– Shawn
Nov 16 '18 at 19:32
By "dynamic form data", do you mean that you have a list of fields that may or may not be in your form submission, that the names of the fields are dynamically generated or something else?
– Shawn
Nov 16 '18 at 20:03
|
show 5 more comments
2
If you know the name of your key, you can just pick off the value. Something likeform.myfieldname
. I don't understand why the loop is a problem.
– James A Mohler
Nov 16 '18 at 13:44
Also, what is your overall objective here? You're apparently iterating through a list of form fields, but why? There may be a better way to solve your bigger issue.
– Shawn
Nov 16 '18 at 19:17
@Shawn I have dynamic form data to insert with mysql. So I was wondering whether there is a function I could use directly with myinsert
query. Right now I'm working withINSERT INTO
student` ( #ListQualify(StructKeyList(form),"")# ) VALUES ( #ListQualify(val,"'")# ) ;
– sg552
Nov 16 '18 at 19:25
1
I'd be very careful about SQL injection with a scheme like that. It's not usually a good idea to insert data directly into a database from form values.
– Shawn
Nov 16 '18 at 19:32
By "dynamic form data", do you mean that you have a list of fields that may or may not be in your form submission, that the names of the fields are dynamically generated or something else?
– Shawn
Nov 16 '18 at 20:03
2
2
If you know the name of your key, you can just pick off the value. Something like
form.myfieldname
. I don't understand why the loop is a problem.– James A Mohler
Nov 16 '18 at 13:44
If you know the name of your key, you can just pick off the value. Something like
form.myfieldname
. I don't understand why the loop is a problem.– James A Mohler
Nov 16 '18 at 13:44
Also, what is your overall objective here? You're apparently iterating through a list of form fields, but why? There may be a better way to solve your bigger issue.
– Shawn
Nov 16 '18 at 19:17
Also, what is your overall objective here? You're apparently iterating through a list of form fields, but why? There may be a better way to solve your bigger issue.
– Shawn
Nov 16 '18 at 19:17
@Shawn I have dynamic form data to insert with mysql. So I was wondering whether there is a function I could use directly with my
insert
query. Right now I'm working with INSERT INTO
student` ( #ListQualify(StructKeyList(form),"")# ) VALUES ( #ListQualify(val,"'")# ) ;
– sg552
Nov 16 '18 at 19:25
@Shawn I have dynamic form data to insert with mysql. So I was wondering whether there is a function I could use directly with my
insert
query. Right now I'm working with INSERT INTO
student` ( #ListQualify(StructKeyList(form),"")# ) VALUES ( #ListQualify(val,"'")# ) ;
– sg552
Nov 16 '18 at 19:25
1
1
I'd be very careful about SQL injection with a scheme like that. It's not usually a good idea to insert data directly into a database from form values.
– Shawn
Nov 16 '18 at 19:32
I'd be very careful about SQL injection with a scheme like that. It's not usually a good idea to insert data directly into a database from form values.
– Shawn
Nov 16 '18 at 19:32
By "dynamic form data", do you mean that you have a list of fields that may or may not be in your form submission, that the names of the fields are dynamically generated or something else?
– Shawn
Nov 16 '18 at 20:03
By "dynamic form data", do you mean that you have a list of fields that may or may not be in your form submission, that the names of the fields are dynamically generated or something else?
– Shawn
Nov 16 '18 at 20:03
|
show 5 more comments
2 Answers
2
active
oldest
votes
I go through your problem. As per my knowledge is not possible to get list of value in structure within single functions. We have to loop the key and get the value of each. But I can give a solution for to get struct value with comma delimited.
<cfset strNew = "a":"10","b":20,"c":30>
Here strNew is my sample structure.
<cfset myList = ''>
<cfloop collection="#strNew#" item="key" >
<cfset myList = listappend(myList,structfind(strNew,key))>
</cfloop>
<cfdump var="#myList#" />
Here I've loop over the structure keys and find the value of an particular key and append that in to and list by using listappend and structfind functions.
So you no need to put like #structure[key]#,In your end of comma(,) is also added the last value of key too. For example your code should return 10,20,30,.
So you no need to do like that. use structfind and listappend you can avoid end of the comma also. Hope it's help you.
add a comment |
Since you're using CF2016, if you want to avoid a loop, you can always use one of the higher-order functions like reduce()
.
fields = formScope.reduce( function(result, key, value)
result.append(value) ;
return result ;
, ) ;
This takes the struct of your form
scope (formscope
) and uses reduce()
to step through it and take it down to a single value (which is the struct values turned into an array). Then we make the returned array into a list.
writeDump( fields.toList() )
My full test code is at https://trycf.com/gist/f00cc62cd4631f44070faf8008e6788f/acf2016?theme=monokai
<cfscript>
formScope =
empty1 : "" ,
fieldl : "text1" ,
field2 : "text2" ,
empty2 : "" ,
field3 : "text3" ,
field4 : "text4" ,
empty3 : ""
;
fields = formScope?.reduce( function(result, key, value)
len(value) ? result.append(value) : "" ;
return result ;
, ) ;
writeDump( fields?.toList() ?: "Form doesn't exist." ) ;
</cfscript>
Giving us: text2,text3,text4,text1
.
formScope
is my simulated version of the form fields that would be passed to this page. I use mostly the member function versions of StructReduce
, ArrayAppend
and ArrayToList
. I also use the initialVal
optional parameter to initialize the reduction's result
value as an array. I check that the value has a length (I could also trim if needed) before I insert a row in the array, allowing me to remove empty elements from my final list. I also use the safe navigation operator (?.
) to do some basic validation to make sure the elements exist (like if the form didn't pass or the reduction produced invalid results) and to make it more error-resistant.
NOTE: I believe that can be taken back to be compatible with CF11, when ArrayReduce
was introduced.
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/structreduce.html
http://ryanguill.com/functional/higher-order-functions/2016/05/18/higher-order-functions.html
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraytolist.html
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339023%2fequivalent-of-structkeylist-for-struct-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I go through your problem. As per my knowledge is not possible to get list of value in structure within single functions. We have to loop the key and get the value of each. But I can give a solution for to get struct value with comma delimited.
<cfset strNew = "a":"10","b":20,"c":30>
Here strNew is my sample structure.
<cfset myList = ''>
<cfloop collection="#strNew#" item="key" >
<cfset myList = listappend(myList,structfind(strNew,key))>
</cfloop>
<cfdump var="#myList#" />
Here I've loop over the structure keys and find the value of an particular key and append that in to and list by using listappend and structfind functions.
So you no need to put like #structure[key]#,In your end of comma(,) is also added the last value of key too. For example your code should return 10,20,30,.
So you no need to do like that. use structfind and listappend you can avoid end of the comma also. Hope it's help you.
add a comment |
I go through your problem. As per my knowledge is not possible to get list of value in structure within single functions. We have to loop the key and get the value of each. But I can give a solution for to get struct value with comma delimited.
<cfset strNew = "a":"10","b":20,"c":30>
Here strNew is my sample structure.
<cfset myList = ''>
<cfloop collection="#strNew#" item="key" >
<cfset myList = listappend(myList,structfind(strNew,key))>
</cfloop>
<cfdump var="#myList#" />
Here I've loop over the structure keys and find the value of an particular key and append that in to and list by using listappend and structfind functions.
So you no need to put like #structure[key]#,In your end of comma(,) is also added the last value of key too. For example your code should return 10,20,30,.
So you no need to do like that. use structfind and listappend you can avoid end of the comma also. Hope it's help you.
add a comment |
I go through your problem. As per my knowledge is not possible to get list of value in structure within single functions. We have to loop the key and get the value of each. But I can give a solution for to get struct value with comma delimited.
<cfset strNew = "a":"10","b":20,"c":30>
Here strNew is my sample structure.
<cfset myList = ''>
<cfloop collection="#strNew#" item="key" >
<cfset myList = listappend(myList,structfind(strNew,key))>
</cfloop>
<cfdump var="#myList#" />
Here I've loop over the structure keys and find the value of an particular key and append that in to and list by using listappend and structfind functions.
So you no need to put like #structure[key]#,In your end of comma(,) is also added the last value of key too. For example your code should return 10,20,30,.
So you no need to do like that. use structfind and listappend you can avoid end of the comma also. Hope it's help you.
I go through your problem. As per my knowledge is not possible to get list of value in structure within single functions. We have to loop the key and get the value of each. But I can give a solution for to get struct value with comma delimited.
<cfset strNew = "a":"10","b":20,"c":30>
Here strNew is my sample structure.
<cfset myList = ''>
<cfloop collection="#strNew#" item="key" >
<cfset myList = listappend(myList,structfind(strNew,key))>
</cfloop>
<cfdump var="#myList#" />
Here I've loop over the structure keys and find the value of an particular key and append that in to and list by using listappend and structfind functions.
So you no need to put like #structure[key]#,In your end of comma(,) is also added the last value of key too. For example your code should return 10,20,30,.
So you no need to do like that. use structfind and listappend you can avoid end of the comma also. Hope it's help you.
answered Nov 16 '18 at 15:03
Kannan.PKannan.P
28217
28217
add a comment |
add a comment |
Since you're using CF2016, if you want to avoid a loop, you can always use one of the higher-order functions like reduce()
.
fields = formScope.reduce( function(result, key, value)
result.append(value) ;
return result ;
, ) ;
This takes the struct of your form
scope (formscope
) and uses reduce()
to step through it and take it down to a single value (which is the struct values turned into an array). Then we make the returned array into a list.
writeDump( fields.toList() )
My full test code is at https://trycf.com/gist/f00cc62cd4631f44070faf8008e6788f/acf2016?theme=monokai
<cfscript>
formScope =
empty1 : "" ,
fieldl : "text1" ,
field2 : "text2" ,
empty2 : "" ,
field3 : "text3" ,
field4 : "text4" ,
empty3 : ""
;
fields = formScope?.reduce( function(result, key, value)
len(value) ? result.append(value) : "" ;
return result ;
, ) ;
writeDump( fields?.toList() ?: "Form doesn't exist." ) ;
</cfscript>
Giving us: text2,text3,text4,text1
.
formScope
is my simulated version of the form fields that would be passed to this page. I use mostly the member function versions of StructReduce
, ArrayAppend
and ArrayToList
. I also use the initialVal
optional parameter to initialize the reduction's result
value as an array. I check that the value has a length (I could also trim if needed) before I insert a row in the array, allowing me to remove empty elements from my final list. I also use the safe navigation operator (?.
) to do some basic validation to make sure the elements exist (like if the form didn't pass or the reduction produced invalid results) and to make it more error-resistant.
NOTE: I believe that can be taken back to be compatible with CF11, when ArrayReduce
was introduced.
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/structreduce.html
http://ryanguill.com/functional/higher-order-functions/2016/05/18/higher-order-functions.html
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraytolist.html
add a comment |
Since you're using CF2016, if you want to avoid a loop, you can always use one of the higher-order functions like reduce()
.
fields = formScope.reduce( function(result, key, value)
result.append(value) ;
return result ;
, ) ;
This takes the struct of your form
scope (formscope
) and uses reduce()
to step through it and take it down to a single value (which is the struct values turned into an array). Then we make the returned array into a list.
writeDump( fields.toList() )
My full test code is at https://trycf.com/gist/f00cc62cd4631f44070faf8008e6788f/acf2016?theme=monokai
<cfscript>
formScope =
empty1 : "" ,
fieldl : "text1" ,
field2 : "text2" ,
empty2 : "" ,
field3 : "text3" ,
field4 : "text4" ,
empty3 : ""
;
fields = formScope?.reduce( function(result, key, value)
len(value) ? result.append(value) : "" ;
return result ;
, ) ;
writeDump( fields?.toList() ?: "Form doesn't exist." ) ;
</cfscript>
Giving us: text2,text3,text4,text1
.
formScope
is my simulated version of the form fields that would be passed to this page. I use mostly the member function versions of StructReduce
, ArrayAppend
and ArrayToList
. I also use the initialVal
optional parameter to initialize the reduction's result
value as an array. I check that the value has a length (I could also trim if needed) before I insert a row in the array, allowing me to remove empty elements from my final list. I also use the safe navigation operator (?.
) to do some basic validation to make sure the elements exist (like if the form didn't pass or the reduction produced invalid results) and to make it more error-resistant.
NOTE: I believe that can be taken back to be compatible with CF11, when ArrayReduce
was introduced.
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/structreduce.html
http://ryanguill.com/functional/higher-order-functions/2016/05/18/higher-order-functions.html
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraytolist.html
add a comment |
Since you're using CF2016, if you want to avoid a loop, you can always use one of the higher-order functions like reduce()
.
fields = formScope.reduce( function(result, key, value)
result.append(value) ;
return result ;
, ) ;
This takes the struct of your form
scope (formscope
) and uses reduce()
to step through it and take it down to a single value (which is the struct values turned into an array). Then we make the returned array into a list.
writeDump( fields.toList() )
My full test code is at https://trycf.com/gist/f00cc62cd4631f44070faf8008e6788f/acf2016?theme=monokai
<cfscript>
formScope =
empty1 : "" ,
fieldl : "text1" ,
field2 : "text2" ,
empty2 : "" ,
field3 : "text3" ,
field4 : "text4" ,
empty3 : ""
;
fields = formScope?.reduce( function(result, key, value)
len(value) ? result.append(value) : "" ;
return result ;
, ) ;
writeDump( fields?.toList() ?: "Form doesn't exist." ) ;
</cfscript>
Giving us: text2,text3,text4,text1
.
formScope
is my simulated version of the form fields that would be passed to this page. I use mostly the member function versions of StructReduce
, ArrayAppend
and ArrayToList
. I also use the initialVal
optional parameter to initialize the reduction's result
value as an array. I check that the value has a length (I could also trim if needed) before I insert a row in the array, allowing me to remove empty elements from my final list. I also use the safe navigation operator (?.
) to do some basic validation to make sure the elements exist (like if the form didn't pass or the reduction produced invalid results) and to make it more error-resistant.
NOTE: I believe that can be taken back to be compatible with CF11, when ArrayReduce
was introduced.
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/structreduce.html
http://ryanguill.com/functional/higher-order-functions/2016/05/18/higher-order-functions.html
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraytolist.html
Since you're using CF2016, if you want to avoid a loop, you can always use one of the higher-order functions like reduce()
.
fields = formScope.reduce( function(result, key, value)
result.append(value) ;
return result ;
, ) ;
This takes the struct of your form
scope (formscope
) and uses reduce()
to step through it and take it down to a single value (which is the struct values turned into an array). Then we make the returned array into a list.
writeDump( fields.toList() )
My full test code is at https://trycf.com/gist/f00cc62cd4631f44070faf8008e6788f/acf2016?theme=monokai
<cfscript>
formScope =
empty1 : "" ,
fieldl : "text1" ,
field2 : "text2" ,
empty2 : "" ,
field3 : "text3" ,
field4 : "text4" ,
empty3 : ""
;
fields = formScope?.reduce( function(result, key, value)
len(value) ? result.append(value) : "" ;
return result ;
, ) ;
writeDump( fields?.toList() ?: "Form doesn't exist." ) ;
</cfscript>
Giving us: text2,text3,text4,text1
.
formScope
is my simulated version of the form fields that would be passed to this page. I use mostly the member function versions of StructReduce
, ArrayAppend
and ArrayToList
. I also use the initialVal
optional parameter to initialize the reduction's result
value as an array. I check that the value has a length (I could also trim if needed) before I insert a row in the array, allowing me to remove empty elements from my final list. I also use the safe navigation operator (?.
) to do some basic validation to make sure the elements exist (like if the form didn't pass or the reduction produced invalid results) and to make it more error-resistant.
NOTE: I believe that can be taken back to be compatible with CF11, when ArrayReduce
was introduced.
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-s/structreduce.html
http://ryanguill.com/functional/higher-order-functions/2016/05/18/higher-order-functions.html
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-a-b/arraytolist.html
answered Nov 16 '18 at 19:14
ShawnShawn
3,86011526
3,86011526
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339023%2fequivalent-of-structkeylist-for-struct-value%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
If you know the name of your key, you can just pick off the value. Something like
form.myfieldname
. I don't understand why the loop is a problem.– James A Mohler
Nov 16 '18 at 13:44
Also, what is your overall objective here? You're apparently iterating through a list of form fields, but why? There may be a better way to solve your bigger issue.
– Shawn
Nov 16 '18 at 19:17
@Shawn I have dynamic form data to insert with mysql. So I was wondering whether there is a function I could use directly with my
insert
query. Right now I'm working withINSERT INTO
student` ( #ListQualify(StructKeyList(form),"")# ) VALUES ( #ListQualify(val,"'")# ) ;
– sg552
Nov 16 '18 at 19:25
1
I'd be very careful about SQL injection with a scheme like that. It's not usually a good idea to insert data directly into a database from form values.
– Shawn
Nov 16 '18 at 19:32
By "dynamic form data", do you mean that you have a list of fields that may or may not be in your form submission, that the names of the fields are dynamically generated or something else?
– Shawn
Nov 16 '18 at 20:03