Data-Nominated Subforms
I thought I would post a little sample on data-nominated subforms tonight. This is a new feature, introduced in Designer 7.1, which can be a very powerful tool.
Since the feature essentially lets you define expressions against values from data being loaded into a form in order to control which subform, from a specified set (subform set containing subforms), will be used for the record currently being loaded into the form, you can do very interesting things. For example, you might have a table which lists data. Maybe you would like to use a row which has a yellow background to identify data which is not important, one with an orange background for data that’s important and one with a red background for data that’s very important. This can be easily achieved using Data-Nominated Subforms.
I’ve created a little sample based on the movie data I used for the Conditional Breaks Sample I posted a few days ago. In this sample, I have a subform set which contains 3 subforms, each capable of binding to a movie record. The twist is that I want to use the green subform for comedies, the red one for action movies and the blue one for dramas.
Minimum Requirements: Designer 7.1, Acrobat Pro 7.0.5.
Note: A basic understanding of Data Binding is required for this sample.
The trick in getting this to work is to first create a data connection which represents the data you’re loading into the form.
Then you need to create the subforms which each contain fields with names set to the data node names from a movie record so that Normal (“implicit”) binding works correctly once the subform is picked for the record.
The next step is to wrap all subforms into a subform set. You can do this by selecting them all in the Hierarchy palette and then choosing Wrap in Subform Set from the context menu.
At this point you’re almost done. All that’s missing are the expressions which tell the Object Model which subform from within the subform set to use for a particular data record.
The Data-Nominated Subform feature is accessed by selecting the subform set and going to the Object palette’s Subform Set tab. There, you’ll find a Type property from which you can select the Select One Subform From Alternatives item. When you select this option, an Edit Alternatives button will appear. Click on that to open the Data-Nominated Subform dialog. In there, you would elect to Choose Subform Using Expression, select your data connection from the drop down list and then specify an expression like
category == "Comedy"
for the “$record.movie” binding (which establishes the scope for your expression) on the comedy subform.
When you preview the form (if you just run it in Acrobat, you’ll have to import the data into the form using the commands under the File menu), you’ll see that the comedy subform is used only for records which have a “Comedy” category name.
Posted by Stefan Cameron on May 10th, 2006
Filed under Data-Nominated Subforms,Tutorials
Both comments and pings are currently closed.
In LC DEsigner I’m getting error
Malformed SOM expression: $record.movie.[category ==”Comedy”]
Arthur,
It sounds to me like you may be trying this sample with Designer 7.0. I should’ve posted the minimum requirements for using the sample which are Designer 7.1 and Acrobat 7.0.5.
If your system does meet the minimum requirements, any additional steps to reproduce the problem would be greatly appreciated.
Cannot open the form. It is password protected.
Rich,
Is it possible that you’re trying to open the DataNominatedSubformsInfo.pdf file in Designer? This is simply a “readme” file (I’m going to rename it to that to avoid future confusion) and is protected from modifications.
The actual sample form is the DataNomSFSample.pdf file, and you should be able to open that one in Designer without any problems.
Can I use subform set to determine which subform to be displayed? thx for replying
Hi:
I have downloaded the data connection controls and was just testing to see if I could update a field in a record after choosing the record.
I want to prove to superiors that we can use Adobe to collect expense data and load it into an Access database before migrating into Excel and then the G/L.
Can data be posted to a database easily enough?
Excuse my ignorance of the product as I have only looked at it over the last 2 days. If you have any samples of code that could help me it would be much appreciated.
What would be a good training course to take to learn Adobe LiveCycle? There is one offered in Phoenix by Carl Young Training Associates. Would it be beneficial to attend MAX 2006 in Las Vegas?
Thanks and sorry for the other questions.
Dwight Beech
Lee,
That’s the whole point of the Data-Nominated Subform feature: It uses a special type of binding on subforms within a subform set which includes a SOM expression. This lets the rendering engine decide which subform within the set to render given the data that’s being merged into the form.
If you look at the XML Source for the “comedy” subform (contained within the “Movies” subform set), you’ll see that it has the following type of binding:
The SOM expression matches all movie records which belong to the “Comedy” category.
Dwight,
I get the feeling that you’re actually referring to my post on Connecting a Form to a Database since you’re talking about “Data Connection Controls” rather than Data-Nominated Subforms (this article).
It sounds to me like what you need is to use a form created in Designer and saved as PDF that you distribute to customers who can then fill and submit information using the Adobe Reader.
You would then receive their data in the form of an XML file which you could then use to enter the data into the database.
If you wanted to, you could create another form using Designer that would let you enter that new data into your database or you could create an automated process on the server which receives the submitted data such that the data would be entered into your database automatically. This could be easily accomplished using Adobe LiveCycle Workflow as this product is designed to create end-to-end workflows for all sorts of business processes including collecting information from clients using LiveCycle form solutions.
Unfortunately, I don’t have any code samples that involve workflows as this requires a server-side setup but you could download the Developer Toolbox for LiveCycle Software and there are some workflow samples here.
If you’re looking only for Designer-specific training, then I would recommend a Designer-specific course like the one offered by CYTA. If you’re looking for information and basic training on various LiveCycle applications, then I would definitely recommend the LiveCycle Track at MAX 2006.
If you like, I could also put you in contact with an Adobe Representative who could tell you more about how you could use an Adobe LiveCycle solution for your organization.
Hi.
In expression category == “Comedy”, Can I somehow use variable instead of “Comedy”?
Lasse,
Unfortunately not. The only thing you can use for the condition script is a data node name and/or a scalar value (string or number). So you can compare two data node values, two scalar values (though this likely wouldn’t prove very useful) or a data node value with a scalar value. Note that you should be able to do some math as well, like “dataNode.value / 2 >= 50″…
If you need to compare to a variable value, you would need to use regular subforms and control their inclusion using the instance manager.