Is it possible to have a dropdown list object with two rawValues?
For example:
John Smith is the diplayed name and the rawValues are his email address and authorized spending limit (5000).
jsmith@emailaddress.com, 5000
If yes, I want the 5000 dollars to appear in textfield1 and the email address in textfield2. How do I access them?
Solved! Go to Solution.
Views
Replies
Total Likes
You can think of an array as kind of like using instance numbers. The split() method is putting each value into it's own "slot" in the array. So to pull information out you just need to specify the slot you want to reference.
In your case you can do away with the loop as you only have two values and just write them out explicitly.
var sElements = this.rawValue.split(",");
email.rawValue = sElements[0]; //first value
dollar.rawValue = sElements[1]; //second value
Views
Replies
Total Likes
This sample from Niall might get you going:
http://www.assuredynamics.com/index.php/portfolio/splitting-an-objects-rawvalue-into-an-array/
Views
Replies
Total Likes
The part I do not understand is how to split the array out to particular existing textfields.
Views
Replies
Total Likes
You can think of an array as kind of like using instance numbers. The split() method is putting each value into it's own "slot" in the array. So to pull information out you just need to specify the slot you want to reference.
In your case you can do away with the loop as you only have two values and just write them out explicitly.
var sElements = this.rawValue.split(",");
email.rawValue = sElements[0]; //first value
dollar.rawValue = sElements[1]; //second value
Views
Replies
Total Likes
Thank you so much, that works great! Now I just have to figure out how to create my list in Excel with the values seperated by commas.
Thanks for your help with this.
Views
Replies
Total Likes
How many vlaues can you have before you have to use the "loop" script?
Thanks
Views
Replies
Total Likes
As long as your spreadsheet is set up with the values going across the columns you can just Save As a CSV (comma separated values) file.
Views
Replies
Total Likes
Doesn't really matter. In Niall's sample he was adding instances and had multiple different values for each item so the loop made sense especially as there were differing amounts of values - so using the array's .length on a given record gives you the correct number of fields.
Really just depends on what you're trying to do, if a loop makes it easier go for it!
I saved the Excel file as a CSV but when I copy and paste into LiveCycle, I get an error that it can not interpret the file. I am using the clipboard button in the dropdown object. I tried pasting the CSV data to Notebook, but it does not show the commas. What am I doing wrong?
Views
Replies
Total Likes
Sounds like you are trying to copy/paste from Excel. You need to open the CSV file in a text editor and copy/paste from there.
Views
Replies
Total Likes
Yes, that was what I was doing. When I open the csv file in the text editor, I get what I need but there are a ton of unneeded commas like:
JohnSmith,50,jsmith@email.com,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Is there a way to prevent them? Or can I just paste them in?
Views
Replies
Total Likes
You should only get the commas you need, unless there is data in the other columns?
I use CSV files quite a lot for mail-merge applications and sometimes get extras rows at the bottom but never seen a bunch of commas like that.
Maybe try selecting the three columns of data and paste into a new spreadsheet and save as CSV. The only thing I can think of is if you have extra columns with titles that might be causing it - usually with CSV the first row is used for naming the columns.
Yes, that fixed it.
Thanks Juno!
-Don
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies