Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Dynamic Field Name - Syntax

Avatar

Level 2

I was also curious as to the naming convention that is applied to dynamic fields.  For instance in one of my documents I have a field named “naics_code”.  This field is dynamic in that the user can add an additional instance.  What would the field name of additional instances that were added by the user?  naics_code-1, naics_code_1?  Thanks.

7 Replies

Avatar

Level 10

Hi there,

When adding instance of an object within LiveCycle, objects are created and renamed with the index based value using square brackets.

If you want to access to the different instances of the object naics_code, you should try resolving the node using the following reference_syntax :

Hope this will help.

Avatar

Level 2

Thanks for the reply.  Unfortunately I still have some additional questions because I've very new to Adobe LiveCycle.  I've also attached an example.

Dropbox - Due Diligence Questionnaire - Retirement-mk.pdf

I'm still a bit confused on how the original field name is handled.  If no additional NAICS Code fields are added, the original filed name is naics_code.  If an additional NAICS Code field is added, is the original field name changed?  I'm trying to determine what the field names are so that we can eventually extract this information from the pdf document and then map that information back into a database.

It appears that the code you've provided me above helps me to set a number for additional fields, but my concern is that the original field name may itself change based on if the user adds a new field or not.  This will definitely make mapping a bit more challenging.  Thanks for all the assistance.

Michael

Avatar

Level 10

Hi again,

either way, if you only have 1 instance or more, the somExpression of that first object will still be named naics_code[0], no matter what, but only within the somExpression

Avatar

Level 2

Thanks for the response.  I just wanted to confirm that I've read this correctly.  Regardless of if the field is dynamic or or not, the syntax would be "field name" = [0], although within the tool it really only shows the field name.  If you have additional instances of that field, then the digit within the brackets would increase at a rate of 1.  Is that correct?

I think I now see this information under the Object -> Binding -> Name section, but I just wanted to confirm.  Thanks again.

Avatar

Level 10

This is correct, although as I said this is only for the somExpression property

if you choose to retrieve the name with the property name, it will not show you the bracket with number

So if you want to retrieve only the name with the number within bracket you can use the following :

Avatar

Level 2

Are you suggesting that I need to use - xfa.host.messageBox(naics_code.somExpression.split(".")[naics_code.somExpression.split("." ).length - 1]); - to lock in the [0] value?  I'm just curious to how an external system will read the form.  I believe my firm will be using Fusion to pull the data off the completed form and not sure if the code above is needed to display the correct syntax or if you're just showing me different options you have at controlling it.

Avatar

Level 10

You will need to test, I'm only showing different options within LiveCycle for you to understand there is a difference between the name and the path to access the object.