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

Adding / Deleteing Rows

Avatar

Level 4

I'm aware of how to Add or Delete a Row to a table where the buttons are located within the table (see Sample 1) but can you have the button located at the buttom of a page instead, outside the table (see Sample 2).  If yes, can you please assist me with the scripting

The reason for this is that I want the row being inserted not to include the Add / Delete buttons again.

Any assistance would be greatly appreciated.

Regards

Jen

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I was merely showing you how to add with the FormCalc reference. You can now add th erest if statement and the rst of your code to the expression.

Paul

View solution in original post

14 Replies

Avatar

Former Community Member

The Add row can certainly live outside of the actual row (when you do an addInstance you are merely adding to the bottom of the stack of subforms). The deleteInstance requires an occurance number so that we know which row to delete. When we add the delete button to th erow we can get the instance number by knowing which button they pressed. This can now be used to remove the right instance. You can have the delete button outside but you will have to indicate which one to delete (it could be the last one, the user could indicate which one).

Make sense?

Paul

Avatar

Level 4

Thanks.  I have got it to work but unfortunately when the row is added the formula isn't updating and therefore is incorrect.

Is there some way of getting the formula to automatic update for the inserted line?

Jen

Avatar

Former Community Member

This is a case where FormCalc is much easier than Javascript. Have a look at what I have done in this modifies sample.

Paul

Avatar

Level 4

The formula that you have used isn't achieving the same end result that I was getting with my 'If' statement.

Your formula

Cell3 + Cell4 + Cell5 + Cell6 + Cell7 + Cell8

My formula

if (Table1.HeaderRow2.Cell3.rawValue == null) {

this.rawValue = Table1.Row1.Cell3.rawValue + Table1.Row1.Cell4.rawValue + Table1.Row1.Cell5.rawValue + Table1.Row1.Cell6.rawValue + Table1.Row1.Cell7.rawValue + Table1.Row1.Cell8.rawValue;

}

else{

this.rawValue = Table1.Row1.Cell3.rawValue*Table1.HeaderRow2.Cell3.rawValue + Table1.Row1.Cell4.rawValue*Table1.HeaderRow2.Cell4.rawValue + Table1.Row1.Cell5.rawValue*Table1.HeaderRow2.Cell5.rawValue + Table1.Row1.Cell6.rawValue*Table1.HeaderRow2.Cell6.rawValue + Table1.Row1.Cell7.rawValue*Table1.HeaderRow2.Cell7.rawValue + Table1.Row1.Cell8.rawValue*Table1.HeaderRow2.Cell8.rawValue;

}

Avatar

Correct answer by
Former Community Member

I was merely showing you how to add with the FormCalc reference. You can now add th erest if statement and the rst of your code to the expression.

Paul

Avatar

Level 4

I have managed to get this to work, thanks,  but now have a slightly different query.

I am wanting to have a click button where the user is able to duplicate a table rather than just a row.

Is this possible and if yes how.  If need be I can e-mail the document to you.

Cheers

Jenny

Avatar

Former Community Member

It is the same technique as adding the row .....the code to add the row navigates down to the row subform level. To add the complete table modify the statement to stop at the Table level instaed of the row level.

Make sense?

Paul

Avatar

Level 4

This is the coding that I used for duplicating the table but it isn't working.  I have

Subform1.Table2.addInstance(1);

Since we can't upload attachment this is basically the page layout:

Page2

     Subform1

          Table2

               Row1

               Row2

               Row3

               Row4

               Row5

     Subform2

          Button1 (this is my add table button)

Your assistance would be greatly appreciated

Jenny

Avatar

Level 4

Date: Fri, 19 Mar 2010 06:55:34 -0600

From: forums@adobe.com

To: bluey72@live.com

Subject: Adding / Deleteing Rows

Can you post your form to mailto:LiveCycle8@gmail.com and I will have a look.

paul

>

Avatar

Level 4

Going forward with my 'Adding Rows' button, is it possible to have the table headings repeated at the beginning of a new page should it roll over when new rows are added (by the clicking the 'Add Row' button).

e.g. The top two greyed rows need to be repeated (at the top of the page) only when the information underneath rolls over to a new page.  Hope this makes sense!!!

I have e-mail the attached to you.

Regards

Jenny

Avatar

Level 4

Hi Paul,



Sorry to do this but can you help again?

I have made you the changes that you suggested but when it all gets put together, it doesn't formatt correctly.  I have e-mailed the attachment to you.

* As you will see the Header (two greyed rows) doesn't carry over on every page for some reason.
* Are we able to arrange for when the new Add Row is inserted that it actually starts on a new page?
* The attachment I actually created an additional two Rows but it hasn't saved the text into the rows making me believe that the Add Row button isn't working correctly.

Regards
Jen

Avatar

Former Community Member

I did not receive an email from you .....did you send it to:

LiveCycle8@gmail.com

Paul

Avatar

Level 4

Hi Paul,

Sorry to do this but can you help again?

I have made you the changes that you suggested but when it all gets put together, it doesn't formatt correctly.

  • As you will see the Header (two greyed rows) doesn't carry over on every page for some reason.

  • Are we able to arrange for when the new Add Row is inserted that it actually starts on a new page?

  • The attachment I actually created an additional two Rows but it hasn't saved the text into the rows making me believe that the Add Row button isn't working correctly.

Regards

Jen

Date: Thu, 15 Apr 2010 06:09:26 -0600

From: forums@adobe.com

To: bluey72@live.com

Subject: Adding / Deleteing Rows

I did not receive an email from you .....did you send it to:

mailto:LiveCycle8@gmail.com

Paul

>

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----