Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to copy data from a fixed table row to 1 of 2 Summary tables

Avatar

Level 6

Looking for a solution to copy specific data from an Inspection table (which has a fixed/pre-determined number of rows) to 1 of 2 Summary table (A or B).

Think of it as Inspection Form:

Each row in the Inspection table with have an inspected item field [Topic] and and a drop-down to indicate whether or not the item passed inspection. If the user select "Yes" for pass, nothing happens. However, if the user selects "No" for fail, an alert will pop-up asking if the topic should be added to Summary table A or B (perhaps via xfa.host.response).

Once the desired table is indicated, the Topic field data (from the active Inspection row) will get dynamically added (new row) to the indicated Summary table. Note: the first field in each row of the Summary table(s) will have a Topic field where the copied Topic data (from the Inspection table) will populate.

As the Inspection form is completed, the same process will happen as described above...for all "No" responses, new rows should be dynamically added to the appropriate Summary table as needed (one for each "No" response and auto-populated Topic text).

Make sense?

Is this possible, or too complicated to achieve?

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Level 8
5 Replies

Avatar

Correct answer by
Level 8

Take a look here.

Kyle

Avatar

Level 6

Kyle (dcidev),

This is awesome; thanks so much for your help. This is exactly what I was loking for - much apprciated!!!

I have only two follow-up questions/comments:

1. How can the form be modfiied so that the pass/fail drop-down menu field is not passed to the Summary table rows? That field should stay with the Inspection table rows, and also used to trigger the dialogue box.

2. Along the lines of #1, how can the form be modified to only copy a specified field from the applicable Inspection row? I only need the first cell to be copied.

Basically the Inspection table would look something like this...

Row 1: Emergency Exists are free from obstructions [Cell 1 - TextField, a pre-populated topic/value], Pass/Fail [Cell 2 - Drop down, selected by user], Comments [Cell 3 - TextField, user will enter text]...Delete button will actually be part of the Summary rows.

Row 2: First Aid Kit accessible and stocked [Cell 1 - TextField], Pass/Fail [Cell 2 - Drop down menu], Comments [Cell 3 - TextField]

...etc

*Note: Ideally, Cell 1 should be a "Text" field populated with a pre-determined  topic (static text), but since you can't copy text from a "Text" field and add it to the Summary row (at least I don't believe you can), those fields will be read-only "TextFields" with the static text added as a default value.

The Summary table(s) would look something like this...(lets say Row 1 failed):

Row: Emergency Exists are free from obstructions [Cell 1, read-only text copied from Inspection table and populated here), Action Required [Cell 2, a TextField where the user will enter comments], Person Responsible [Cell 3, a TextField where the user will enter comments ] .

So as you can see, only Cell 1 is copied to the Summary table. The remaining fields in the Summary table rows should be empty TextFields for custom text input (not populated from the Inspection Table).

If you can help me with these 2 items, I'll be good to go!!!!

Thanks again in advance!!!!

Avatar

Level 8

That's easy.

1) In the script for DropDownList1 remove the line

newRow.DropDownList1.rawValue='false';

2) I also created a function transferData. Remove all the code between the two curly braces {} and specify the fields you want transferred by name. For instance, if you want Cell4 to go to Cell2 in your summary table put:

target.Cell2.rawValue=source.Cell4.rawValue;

That's it!

Kyle

Avatar

Level 6

that's what I thought, but wnate ot make sure.

Thank you very much!

Avatar

Level 8

Also like to give credit to Bruce (BR001) for his dialog development utility that I used for this form.

http://adobelivecycledesignercookbookbybr001.blogspot.com.au/

Kyle