Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

How do you transfer a table row (instance) from table1 to table2??

dgray_au
Level 1
Level 1

Hello - I'm an active user of the Adobe LC designer suite but i'm getting into difficult territory (for me) with respect to javascript coding!

my problem is this: how do you transfer a table instance (row) from table 1 object to table 2 object??

i.e. there are 2 tables on one form and i want to click a button that will remove the first row from Table1 and insert that same row (data intact) at the bottom of table 2

the code i used below doesn't work! (it could be complete rubbish though... like miles off the mark)


var oTransferInstance = form1.pg1.subformRow[0];
var nIndexFrom = oTransferInstance.index;
var nIndexTo = form1.pg2.subformRow.index + 1;

form1.pg1.subformRow.instanceManager.moveInstance(nIndexFrom, nIndexTo);

PLEASE HELP!! I will be so grateful

regards

David

1 Accepted Solution
pguerett
Correct answer by
Level 10
Level 10

Sure send it to LiveCycle8@gmail.com and include a descriptionof the issue.

Paul

View solution in original post

8 Replies
_Nith_
Level 10
Level 10

moveInstance() method will not work across tables.

So you will have a write script to delete row from table1 and add a new row to table2.

Can you share your form so that I could try to write the javascript?

Nith

dgray_au
Level 1
Level 1

Awesome - that would be great!

I am trying to link the pdf related to the question into this post (i've hosted it on acrobat.com in a shared folder) - if it works it should be listed below:

https://acrobat.com#w=REv1lC07GdE*xjycFYDfOw

** It's a slightly different form to the one i was working on in the office - but the question and solution is still 100% relevant and if you think you can code a solution in this form, then i will be able to transfer your solution into the form i was working on earlier.

Good luck - I really appreciate the help.

Regards

David

dgray_au
Level 1
Level 1

Hi Nith - I just found your email in my gmail account - it got swept

up by a filter...

Anyway your offer to look at it for me is fantastic - I have attached

the file to my reply

**NOTE: It's a slightly different form to the one i was working on in

the office - but the question and desired result is still 100%

relevant and if you think you can code a solution in this form then i

will be able to transfer your solution into the form i was working on

earlier.

Good luck - I really appreciate the help.

Regards

David

dgray_au
Level 1
Level 1

I feel like I am very close to an answer at this point - I just need a little further guidance to finish me off...

DAVID WATTS ON GOOGLE GROUPS SUGGESTED THAT I DO THE FOLLOWING:

>In a nutshell, I think you need to:
> STEP 1 - use the second table's InstanceManager to create a new row
> STEP 2 - copy the values from the first row into the new row - by "instance"
>here you mean a row, right?
> STEP 3 - use the first table's InstanceManager to delete the first row
>Dave Watts, CTO, Fig Leaf Software

I have coded Step 1 and Step 3 successfully but my step 2 is not doing the job - see my code below:

form1.pg2.orderItem.instanceManager.addInstance();         // Step 1

var xQty = this.parent.resolveNode("numQty");            // Step 2
var xPrice = this.parent.resolveNode("numPrice");   

form1.pg2.orderItem.numQty[1].rawValue = xQty;
form1.pg2.orderItem.numPrice[1].rawValue = xPrice;

form1.pg1.orderItem.instanceManager.removeInstance(this.parent.index);      // Step 3

I have posted the form in a shared folder (link below) on acrobat.com for those interested (is there any other way / a better way to give the user community access to your forms??)

https://acrobat.com/#d=IpFYXBn5e6g3GXUiH4TCXA

Regards

David

pguerett
Level 10
Level 10

Your var xQty has the XFA object numQty not the rawValue of numQty. So you can either modify your assign statement to get the rawValue like this:

var xQty = this.parent.resolveNode("numQty").rawValue;

Or...

You can reference the rawValue property when you reference the xQty variable ...like this:

form1.pg2.orderItem.numQty[1].rawValue = xQty.rawValue;

The same thing applies to the xPrice. Note that the object assist will not appear for the variables as at Design time the object has not been assigned.

Paul

dgray_au
Level 1
Level 1

Hi Paul - I appreciate your help and I have a murky 'in principle' understanding of why your solution should work BUT i have been tinkering around for the last hour and i can't seem to get the result I'm looking for - specifically - i want to create the appearance of a row 'dropping' out of one table and joining the bottom of the second table.

I feel i'm close but i'm obviously still doing something wrong - is it possible for me to send you my form for you to review?

Thanks for having a go at it (and that tip on the object assist).

Regards David

pguerett
Correct answer by
Level 10
Level 10

Sure send it to LiveCycle8@gmail.com and include a descriptionof the issue.

Paul

View solution in original post

dgray_au
Level 1
Level 1

Hi Everyone -

Paul from Adobe has answered this uestion for me - the code is published below:


form1.pg2.orderItem.instanceManager.addInstance();         // Step 1

//Step 2   

xfa.resolveNode("form1.pg2.orderItem[" + (form1.pg2.orderItem.instanceManager.count - 1) + "].drpTicker").rawValue = xfa.resolveNode("form1.pg1.orderItem[" + this.parent.index + "].drpTicker").rawValue;
xfa.resolveNode("form1.pg2.orderItem[" + (form1.pg2.orderItem.instanceManager.count - 1) + "].numQty").rawValue = xfa.resolveNode("form1.pg1.orderItem[" + this.parent.index + "].numQty").rawValue;
xfa.resolveNode("form1.pg2.orderItem[" + (form1.pg2.orderItem.instanceManager.count - 1) + "].numPrice").rawValue = xfa.resolveNode("form1.pg1.orderItem[" + this.parent.index + "].numPrice").rawValue;

form1.pg1.orderItem.instanceManager.removeInstance(this.parent.index);      // Step 3

I have included a link to my form for thoise wanting to see "what is going on" inside the form

https://acrobat.com/#d=AUSC4T871MF4yfnje4nrMg

I hope this helps others!!

Regards

David