Expand my Community achievements bar.

linking rows of 2 tables

Avatar

Level 3

I have two tables.

The first containes names and a yes/no button.

there is a button to add more rows to this table to add more names

Table 1

Namecostquestion
O yes      O no

| Add row |

the second table with only 1 row, contains 4 check boxes.

Table 2

Header 1

O  car

O  train

O  bus

O  metro

when a user adds a new row to table 1, a row must be added to table 2 too

that is not a problem.

but when, for example, the user checks "yes" at row 3 of table 1, only 2 checkboxes of row 3 at table 2 must show

and when the user checks "no" at row 3 of table 1, all 4 checkboxes at row 3 of table 2 must show

I have no idea how to do this

Anyone an idea?

5 Replies

Avatar

Level 10

I have a sample here that might help. If you do a search for two way binding at www.assuredynamics.com. Niall

Avatar

Level 3

Niall,

This is more than helpfull

It solved my problem.

Can you help me also with an other problem?

The first cell at the first row is an exception. This cell gets te value of an other field on the form.

The user can add additional rows with a button, but at the beginning there is only one field.

How would you create such an exception?

Avatar

Level 10

Hi,

I think I understand what you are looking for.

You want the first cell in the first row to have the value of the other field, but all other instances of the first cell (in subsequent rows) are to be blank. Is this the case?

If so you could have script in the layout ready event of the first cell that looks at it's parent index and if this is 0 (eg the first row) then populate with the rawValue of the other field. Otherwise null.

Come back if you have problems with the script.

Niall

Assure Dynamics

Avatar

Level 3

Niall,

I understand wat i have to do now.

I can use:

Instancemanager.count > 1

or

this.parent.index == 0

The problem now is that the cells are subforms.

I had to do that because of some styling issues

But i cannot get the parrent index of a field/button within a subform.

Do you know how to solve/bypass this?

Avatar

Level 10

Hi,

To get to the index of the repeating object, you may need to work your way up the table structure. So if you count the containers from the object where you are scripting up to the repeating object, then include this in the script. For example three levels would look like this:

if (this.parent.parent.parent.index == 0)

{

     // script

}

Hope that helps,

Niall

Assure Dynamics