Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Dropdown List Not Refresh with Static PDF

Avatar

Level 2

Hi,

I'm using LiveCycle ES2 version 9 to design my form and view using Acrobat X Pro. In my form, I have a dropdown list that binds to a data connection to populate the list of products available. The SQL query of the data connection is as simple as below,

    

     "SELECT ProductCode, ProductName FROM PUB_Product WHERE ActiveInd = yes"

Everything works perfectly when I save my PDF in dynamic form. However, due to some limitation with dynamic form, I have no choice but to save the PDF in static form. Problem with static form arises when there are changes to PUB_Product table which could be adding/removing product, setting an active product to non-active and etc. In case of any changes, I have to re-open the PDF in LiveCycle and save it in order to have the latest data reflected in the form. Is there anything I can do so that the changes to the product table will straight away reflected in the form without having to re-save it?

Thanks in advance for your advise.

Regards,

Steven

8 Replies

Avatar

Level 10

Not sure that I follow ...the ability to access a database is not tied to whether the form is dynamic or static .....it is controlled by a Reader Extensions right (assuming you are using Reader). Can you clarify please?

Paul

Avatar

Level 2

Hi Paul,

Thanks for helping. I'm using Acrobat to view the PDF form. Thus, shouldn't have any problem connecting to the database.

I've captured some screenshots as below and hope it helps you understand my situation better.

This is my Access database

Screenshot.JPG

This is my PDF. Added a data connection "Product" using SQL Query "SELECT ProductCode, ProductName FROM PUB_Product WHERE ActiveInd=yes" whereby it will only extract the "active" products.

Screenshot.JPG

Binded the product code dropdown list with "Product" data connection to populate the list.

Screenshot.JPG

The output of the PDF form. Only the active products are being listed.

Screenshot.JPG

Now, if let's say I add a new product to my PUB_Product table, the dynamic form will straight away list the new product but not the static form.

Screenshot.JPG

Dynamic form

Screenshot.JPG

Static form

Screenshot.JPG

In order to see the new product listed in the static form dropdown list, I have to re-open the form in Live Cycle and just simply save it. So my question is, is there anything I can do to skip this "open and save" step?

Screenshot.JPG

Thanks.

Regards,

Steven

Avatar

Level 10

The connection to the database is established when the form opens so in a dynamic form the form opens and the connection is established, and the DDlist fi

lls up with what is there at that moment. The nature of dynamic forms is such that the form will be redone if something changes, so when when the DB changes the form sees that and redraws.

Static forms do not do that unless they are told. Just as a test to make sure we can do this add a button on the form and add this code to the click event:

xfa.layout.relayout()

Now render your form, change your database and hit the button. Does the change appear in your DDList?

Paul

Avatar

Level 2

Hi Paul,

Tried what you've suggested both in FormCalc and JavaScript but no luck here. The DDList just won't get refreshed =(

Regards,

Steven

Avatar

Level 10

Can you try changing the code on your button to be xfa.sourceSet.DataConnection.requery. This will cause the DB query to run again and I want to see if the DDList wil update.

Paul

Avatar

Level 2

Hi Paul,

By changing the code as you suggested, I believe it does trigger the query to re-run as I could see the DDList was defaulted to other value which was not in the original list. However, the DDList was still not updated with the new item. Is there anyway to refresh the DDList or something?

Steven

Avatar

Level 10

Ok so we know that if we requery we will see the new value. The issue is knowing when to requery....so what if we were to cause a refresh of the query each time the user entered the DDList.....so on the preOpen event if we closed then opened the connection again that should cause the bindings to refresh. So enter the code:

xfa.sourceSet.DataConnection.close()

xfa.sourceSet.DataConnection.open()

Paul

Avatar

Level 2

Hi Paul,

Sorry for not responded for so long as my harddisk was corrupted two weeks ago and only manage to recover everything back last week.

I've tried the method from your last reply. Instead of entering the code to preOpen event, i've added lines below to initialize event as we only need the list to be refreshed everytime users open the file:

xfa.sourceSet.Product.requery()

xfa.sourceSet.Product.close()

xfa.sourceSet.Product.open()

However, the DDList still won't get updated with changes made in the database (deactivate or add new product). You may download the test pdf form and the access db from this link http://www.4shared.com/get/5_7G6NOY/Static_DDList.html in case you want to give this a test yourself. You just need to create an ODBC named "Temp" that points to the access db for it to run.

Is there any command for un-binding and re-binding the DDList during runtime?

Regards,
Steven