Expand my Community achievements bar.

SOLVED

Auto Copy column contents to another column

Avatar

Level 3

I have two tables:  A and B.  A has a row called 'Analysis' and B a row called 'Remarks'; this table only has 1 row.  There is a button in the Analysis row that when clicked inserts a row after the first for both tables.  Both tables have a column called 'WBSCLIN' and they are text fields.  I need to have Remarks 'WBSCLIN' match Analysis 'WBSCLIN'.

I have tried many different formulas but I always end up getting Remarks 'WBSCLIN' to equal the first column cell (first row) of Analysis 'WBSCLIN' the whole column down.  It would be nice if there was a formula I could put in the Remarks 'WBSCLIN' cell on Row 1 that would get repeated everytime the button was pressed; however, I would be just as happy if there was a formula I could put in another button called 'generate' that when pressed would copy the column from 'Analysis' to 'Remarks'.  It is important to note that Table A has 4 rows to start: the first row which will contain data, the second is a blank spacer, and the last 2 are Totals sections that total columns and such. If the solution requires me to break this into another table, I am ok with that too.

Any help would be appreciated.

Thanks,

Mallard27

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Then you will need to know which instance of the row you are on. You can get that by using the this.parent.index on any object in the row.

Paul

View solution in original post

6 Replies

Avatar

Former Community Member

If this is a repeating row then each Remarks field will have the same name in each row. So to indicate which one you want you must use the full path to the field (including occurance numbers where neccessary). So using standard table structures:

TableB.Row.comments.rawValue = TableA.Row.remarks.rawValue

This statement will always take the 1st row of each table as its default.

So you must include the occurance of th erepeating subform .....in this case Row.

So the expression shoudl read:

TableB.Row[1].rawValue = TableA.Row[1].remarks.rawValue.

If you need to programmatically set the occurance with a counter [i] then you must use a different notation to have the counter resolved before the expression is evaluated. The xfa.resolveNode syntax allows you to enter a strinng for the expression to be evaluated. This style will work:

xfa.resolveNode("TableB.Row[" + i + "]").rawVlue = xfa.resolveNode("TableA.Row[" + i + "]").rawValue;

Make sense?

Paul

Avatar

Level 3

Paul,

I have tried the following:

Table A = Analysis_Summary

   Row in question = Analysis

   Cell I want = WBSCLIN

Table B = Remarks_Summary

   Row in question = Remarks

   Cell I want = WBSCLIN

var i = 0;
xfa.resolveNode("Remarks_Summary.Remarks[" + i + "].WBSCLIN").rawVlue = xfa.resolveNode("Analysis_Summary.Analysis[" + i + "].WBSCLIN").rawValue;

I end up getting the same value repeated on every line I insert.  I know I must be missing something.

Thanks,

Mallard27

Avatar

Former Community Member

But i is always = to 0 hence you are always referencing the first row. Are you trying to do this after the tables have been completed or as th euser is filling it out row by row? Also there is a typo in th eremarks_summary statement.....rawVlue shoudl be rawValue

Paul

Avatar

Level 3

Paul,

Preferably, while the user is filling it out row by row.  If that is not possible, then I would be ok with using a button to do it.

Thanks,

Mallard27

Avatar

Correct answer by
Former Community Member

Then you will need to know which instance of the row you are on. You can get that by using the this.parent.index on any object in the row.

Paul

Avatar

Level 3


Thanks Paul!

For anyone interested, here is the final code i used in FromCalc; and it works flawlessly:

form1.Remarks_Page_3.Remarks_Summary.Remarks[this.parent.index].WBSCLIN = form1.Analysis_Summary.Analysis[this.parent.index].WBSCLIN

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] ----