Highlighted

Table with multiple body rows (table section), how to bind data?

loather

06-02-2019

My general understanding of data binding is "vague" at best but currently I am struggling with a table that should have multiple body-lines.

As best I understand it, the binding for the table of data is made against the body row, NOT the table.

This then causes the rows to repeat for each row in my XML source data.

However, I have a large number of columns in my table and it requires multiple body-lines for each row of the data table.

I've created a 2nd body-line and wrapped both body-lines in a table-section.

What surprised me is that I cannot bind the table of data to the table-section.

The table of data remains bound to body-line 1 - which is working fine & showing the values of the fields.

For body-line 2 - how can I get access to the data? If I re-bind the same object as body-line 1, I get to the fields I want but it has advanced to the next row.

Thanks in advance

Replies

Highlighted

loather

07-02-2019

It feels so dirty but for now I've gone with a kluge:

In body-line 1 I took 1 of the existing text fields & wrapped it in a subform. I then added another text field in the subform, bound it to the data element I need & made its presence hidden.

In body-line 2, I have a text field and used the Initialize event to set the value from the hidden text field of body-line 1.

Works but there must be a "proper" way I've yet to figure out...

The trouble with all this stuff ["business development"] is that the priority is to find a solution which works.

I do really try to avoid sins such as the above but sometimes the project timelines dictate otherwise

Highlighted

loather

14-02-2019

Today I found myself with this problem in another area.

I went with a different workaround that requires no scripting:

1] do not create any table section and just stick with 1 body line in the table

2] wrap each cell object of the table line in a subform [so the subforms become the actual cell objects]

3] make the subforms 'positioned' and make them the height of 2 rows

4] place 2 text-fields or whatever above each other in the subforms and bind them to the correct elements of the data table row

5] if required, use bottom border of the upper fields to simulate table row borders

This feels less dirty though I am not sure if it is heavier on rendering engine or not. I mean at runtime, with all the subforms in all manner of places which seem "necessary", and with things like tables using them also, I would not be surprised that a long document would cause 1000s of subforms to be rendered. Unsure how bad this is but it hasn't killed anything yet.

Highlighted

_Bruce_Robertson

MVP

15-02-2019

Hi,

If you are trying to bind to alternating rows of data then have a look at subformsets, you can define multiple subforms under a set and it works out which one to use.

Regards

Bruce

Highlighted

loather

19-03-2019

Thanks for this,

I was just reading in a "best practices" document about Livecycle which happens to give an example of a multiline table and the first thing it says to do is use nested subforms to emulate a table.

So whether subform sets are used or not, it seems that the main point is "don't try to do this with a table object".