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.

Concatenating an entire dynamic table! Help please!?

Avatar

Former Community Member

Hi

I need to take the contents of an expanding table, concatenate it and then add all the 'rows' of text together in a text field. Hopefully below will explain:

This table needs to be concatenated and then inserted in a single text field

table.JPG

To be inserted into a single text field to become:

Mickey Mouse Level 1 General Legal m.mouse@disney.com 1234567890

Donald Duck Level 2 - Specialist - Exercise Leader Consumer d.duck@disney.com 0987654321

I'm relatively new at LiveCycle and have scoured the net for the Javascript to steal do this however I have not been able to find anything and am unsure of the best approach?

I am struggling to reference each of the new row instances and also to combine into one text field? Can anyone point me in the right direction please?

Much appreciated!

Ellis

18 Replies

Avatar

Level 10

Hi there,

I don't know what is the hierarchy of your form... but your code should look something like this, considering your table is named "Table1" and your rows "Row1"

In the textfield which you want to have the concatenated string, go in the Calculate event and write this in javascript...

I also would consider you have a subform which contains your textfield and that subform can have multiple instances

This should do the trick, just make sure you have the right paths for each object in your row

Hope this help!!

Avatar

Former Community Member

Hi Magus

Thanks a lot for your reply, my hierarchy is complex tbh but I'll give this a go

Thanks again - really appreciate you taking the time.

I'll post my results later!

Ellis

Avatar

Former Community Member

Hi

I've tried in vain for hours to get this to work - it's almost there I feel, but I can still only get the first row to populate the text field I want to concatenate everything in. (I've reduced the target text to just the Name field for the time being until I get the code working to simplify.)

Any advise would be much appreciated and probably save a few of my hair follicles as I am pulling them out over this!

This is an image of the hierarchy and the code I have on the calculate event of the text box:

Concat1.JPG

And this is the result: only the first row is pulled across?

concat2.JPG

I suspect it's hierarchy or possibly the way I am repeating the row with the '+' button - here is the code behind that in case it helps:

form1.BCMTeamSubform.FullRowSubForm.RepeatableRow.BCMTeamRow1.Subform1.Button1::click - (JavaScript, client)

//This assigns rowNum varaible as being 1 more than the table index then adds a row at this postion when Butto1 is clicked thus adding to bottom of table

var rowNum = this.parent.index + 1;

this.parent.parent.parent.instanceManager.addInstance(rowNum);

//the number of 'parents' above will depend on the heirarchy of the form

concat3.JPG

Avatar

Level 10

Hi there,

So I've noticed that your repeatable row is your table and not the row itself, which that will change your code,

It is much easier to tell what to do when we know how the hierarchy looks like, so here we go


Hope this will work!

Avatar

Former Community Member

Hi

Thanks for the reply, I've inserted the code above into the calculate event of the textbox but no text is being displayed in the concatenated textbox at runtime? I'e tried to examine your code for any typos but cant see anything obvious (tbh I'm new to JS so propbably wouldn't ) - is there anyway I can attach the form to this thread?

Many thanks for your help Magus

E

Avatar

Level 10

You can store your PDF on Google drive and send me a link so I can download it, or any website which can store a file and be downloadable

Avatar

Former Community Member

Thanks !

I've placed the pdf on my shared DropBox folder here https://www.dropbox.com/sh/t4f0unotyb2wxik/AABl62mGqI0k7Aimaqvvv5Bfa?dl=0

Hopefully you can access it?

Cheers

Ellis

Avatar

Former Community Member

Absultely brilliant ! Many Thanks!

I have several of these to do for my form and will use your code as the basis for all of them.

I will endeavour to understand your code and utilise it ( I supspect I will encounter difficulties later as I have repeating subforms which look like tables but I'll cross that bridge when I come to it! )

Many, many thanks

Ellis

Avatar

Former Community Member

Hi Magus

Soo... I've managed to use your code for 3 sections of my (rather complicated!) form - FANTASTIC THANKYOU!  however I have one other type of  'expanding section', and I am unable to get it to work for.

The problem is one of hierarchy I believe as my 'repeatable section' includes an 'Add Details' hidden section that needs to repeat for every row. I think this may be screwing up the referencing for the code you have kindly supplied and I can't figure out the correct referencing (I've tried everything! ). It kind of works when I place the concatenated text field in the same subform however the text field also then gets repeated which is not desired.

I'm trying to achieve the same result as previously (ie the concatenated single text field with the 'Workforce Name', 'What does it deliver' etc  (btw I think I'm fine adding and removing these as required as I can understand the code))

I would be really grateful if you could advise or 'work your magic' please? I've placed the section of the form on my dropbox as previously below.

Dropbox - EBIA Example Used for Forum 5.pdf

Cheers

Ellis

Avatar

Level 10

Sorry for waiting so long for answering back, seems like your link is not working anymore...

do you still need help to have this fix?

Avatar

Former Community Member

Hi Magus

Thanks for getting back Magus - Yes I absolutely do still need help , tbh I have been trying everyithing to get this resolved as I'm under pressure from work to deliver my form!

Basicaly I am trying to do the same as before but have a different hierarchy and I have been unable to get the referencing correct

I have a form and I need to take the contents of an expanding table, concatenate it and then add all the 'rows' of text together in a 'Concatenated' text field (CONCAT Workforce). Hopefully below will explain:

The expanding table below:

Workforce5.JPG

Needs to be concatenated in the 'CONCAT Workforce' Textfield to display as:

Mickey Mouse Team 1 Widgets Brand Marketing Contact Centre Normal Business Hours

Donald Duck Team 2 Wingnuts Corporate Communications Engineering Extended Hours


The problem is one of hierarchy I believe as my 'repeatable section' includes an 'Add Details' hidden section that needs to repeat for every row. I think this may be screwing up the referencing for your code and I can't figure out the correct referencing (I've tried everything! ). It kind of works when I place the concatenated text field in the same subform however the text field also then gets repeated which is not desired.

The link below is as close as I can get in that it picks up the first instance only, I have several other sections of the form that have the identical hierarchy as this and am hoping I won't need to alter it to fix the issue. If you could take a look Magus it would be awesome!? Also (if I can be cheeky!) could you put some notes in the code explaining what is going on? This will help me understand and be able to alter the code if required for further sections)

Dropbox - EllisTest2.pdf

Thanks buddy

Ellis

Avatar

Level 10

Hi there, your link is still not working

Avatar

Former Community Member

Hi - the new link EllisTest2.pdf seems ok to me

This one :

https://www.dropbox.com/s/fy3i5m14n3uhgwv/EllisTest2.pdf?dl=0

Can you try to access please?

Thanks!

Ellis

Avatar

Level 7

I do not think this is working and I have had this file crash LCD for me several times with a Runtime error. Not sure what is going on.

Avatar

Former Community Member

Hi

Strange . I've removed all the files from my dropbox share and have re uploaded version 5 here:

https://www.dropbox.com/s/vgcoti8geta0a1y/EBIA%20Example%20Used%20for%20Forum%205.pdf?dl=0

Can you access it?

Thanks

Ellis

Avatar

Level 10

Hi ellis, yes I managed to download your pdf from your dropbox.. seems like my browser was the issue.

I've taken a look at your pdf and I don't seem to understand what you are trying to do as it looks all good to me when I try it, of course the code is not complete yet...

but what is it exactly you are trying to do and it's not working?

Avatar

Former Community Member

Hi Magus

Thanks for responding - I've managed to sort this issue thanks. I have another issue (my form is losing conditional formatting when saved) which I'll post seperately - thanks for your help mate appreciate it

Ellis