These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Scripting values to a dynamic table

mp2009
Registered: Feb 6 2009
Posts: 6

I have a from that can be used by multiple uses each of whom has a range of contacts. I need these contacts to be placed on a dynamic table when the users selects their name from the drop down menu.

Each users has a varying number of contacts.

I have using the same method as for population drop down lists to no effect. Any help would be appreciated.

Thanks

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Did you already read this article?

http://www.acrobatusers.com/tutorials/2007/js_list_combo_livecycle/

The methods used here will work for your form. All you need to do is change the object that is used to populate the 2nd drop down, to hold the values for your table. Instead of populating another list, the selection would populate your table.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

mp2009
Registered: Feb 6 2009
Posts: 6
Thanks but that is not quite what i am after.

Below is a sample dataset

addess Paper 1 Paper 2 Paper 3 Paper 4 Paper Boy
1 a road y Bob
2 a road y Bob
3 a road y James
5 b road y y James
12 y y James
7 y Sam
9 y Sam
8 y Sam

What i want to be able to do is show a table that expands to display only shows for the addresses for the selected user and fills in the appropriate information. Can I do this in adobe or do i need to use something like access?

Thanks
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes you can do this in a LiveCyle Form.

Where does this data live? is it in an external data file? in the form itself?

You said that the drop-down contains a list of user names. How do you relate the user name to a line in the dataset?

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

mp2009
Registered: Feb 6 2009
Posts: 6
Sorry to clarify the table

There should be six columns Address, Paper 1-4 and Paper Boy

At present the Data is coded within the form. The user drop down relates in this example to the paper boy.

So for example if the user Bob was selected the dynamic table would display only two rows each containing only five columns these being Address and Papers 1 - 4 as the paper boy column now becomes redundant.

Thanks
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ahh, that's makes much more sense. Good explainations are very important since none of us have a clue as to what you are trying to do.

Ok, The basic strategy is pretty easy. First, you need to make one line of your table into a repeatable subform. Place the data into an array of generic objects in Scripting Object, Like this
var aData = [{address:"1 a Road", Paper1:true, Paper2:false,  Paper3:false,  Paper4:false,  PaperBoy:"Bob"},{address:"2 a Road", Paper1:true, Paper2:false,  Paper3:false,  Paper4:false,  PaperBoy:"Jim"},];

Then write a function to return an array of just those entries that match the name. Put it in the same Scripting Object.
On the Change event of the pull-down. Call this function then use the "setInstance" function to create the number of table lines you need and fill them in with the data.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script