bkurzbuch Posted May 18, 2016 Share Posted May 18, 2016 I have the code for 2 arrays and need some help with the proper syntax for adding "$" in front of each field. I know what I need to do, but have tried several variations with a syntax error every time. A point in the right direction would be greatly apprecatied. Thank You var OptionHeaderArray = ["Individual "+Field("Pay Period"), "Two-Party "+Field("Pay Period"), "Family "+Field("Pay Period")]; var UAArray = [Field("UA Individual"), Field("UATwo-Party"), Field("UA Family")]; var UAPlusArray = [Field("UA Plus Individual"), Field("UA Plus Two-Party"), Field("UA Plus Family")]; var OptionHeaderFilledArray=[]; var UAFilledArray=[]; var UAPlusFilledArray = []; Quote Link to comment Share on other sites More sharing options...
step Posted May 18, 2016 Share Posted May 18, 2016 (edited) I have the code for 2 arrays and need some help with the proper syntax for adding "$" in front of each field. I know what I need to do, but have tried several variations with a syntax error every time. A point in the right direction would be greatly apprecatied. Thank You var OptionHeaderArray = ["Individual "+Field("Pay Period"), "Two-Party "+Field("Pay Period"), "Family "+Field("Pay Period")]; var UAArray = [Field("UA Individual"), Field("UATwo-Party"), Field("UA Family")]; var UAPlusArray = [Field("UA Plus Individual"), Field("UA Plus Two-Party"), Field("UA Plus Family")]; var OptionHeaderFilledArray=[]; var UAFilledArray=[]; var UAPlusFilledArray = []; Actually, you have 6 arrays. Each of your variables is assigned to an array. Let's take, for example, the array you've assigned to the 'UAArray' variable. If you want to put a dollar sign in front of the value of each of those fields you could just physically prepend it like this: var UAArray = [ [color="Red"]'$' + [/color]Field("UA Individual"), [color="Red"]'$' + [/color]Field("UATwo-Party"), [color="Red"]'$' + [/color]Field("UA Family") ]; Or you could use the map method: var UAArray = [ Field("UA Individual"), Field("UATwo-Party"), Field("UA Family") ][color="Red"].map(function(element){ return '$' + element; });[/color] Edited May 18, 2016 by step Quote Link to comment Share on other sites More sharing options...
bkurzbuch Posted May 18, 2016 Author Share Posted May 18, 2016 Thanks Stu - Now I kind of get it. This seems to be my Biggest stumbling block. Getting the syntax correct. Thank you for the explanation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.