Expand my Community achievements bar.

SOLVED

adding records

Avatar

Former Community Member

how do i add records to a second table that is linked by the employee field to the id of another table?

i have two tables created.  the first with just the id and a field for employee name. the second table contains the fields id, employee, date, and time.

the id of the first table is linked to the employee of the second table.

thanks for the help

1 Accepted Solution

Avatar

Correct answer by
Level 10

I am out of the office now. That will work, but only if the relative reference to the object "Table1.Row1.employeeID" matches your hierarchy.

See here for info/PDF on referencing objects: http://assure.ly/kUP02y.

Niall

View solution in original post

6 Replies

Avatar

Level 10

Hi,

The easiest way to do this without scripting is to name the employeeID field and the employeeName field the EXACT same in both tables. Then select the employeeID field in either table and go to the Object > Binding palette. Set the binding to "Global" and then do the same for employeeName.

At runtime the values inputted into one table will automatically be reflected in the other table.

Hope that helps,

Niall

Avatar

Former Community Member

Hi Niall,

Thanks for helping out.

I think I have already gone a seperate direction.

The form that I am trying to create is basically an employee time clock that checks in and out the work time for an employee.

I created the first table providing just the id and name of the employee. I created a second table consisting of id, employee, date, punch time. The second table is linked to the ID field of the first table to Employee field.

when an employee runs the form, they select their name from a dropdown list from the databse and then presses a button to submit their time to the punch time.  pressing this button creates a new record in the second table only and updates the with time, date...

so far it's creating the new record and updates the info but does not update anything for the employee field.  it remains blank.  I want this employee field to have the value of the ID from the first table...

thanks for all the help!

Vincent

Avatar

Level 10

Hi Vincent,

You could use a script in the calculate event of the employeeID in Table2.

this.rawValue = Table1.Row1.employeeID.rawValue; 

The above script is JavaScript and you would need to adjust the reference to the ID field to suit your hierarchy.

Hope that helps,

Niall

Avatar

Former Community Member

hi Niall,

i think i'm almost getting it...

would this statement

this.rawValue = Table1.Row1.employeeID.rawValue;

return the numeric value of the id into the numeric field of employee?

in what part of my form should i put this? in the button i press to update fields?

Avatar

Correct answer by
Level 10

I am out of the office now. That will work, but only if the relative reference to the object "Table1.Row1.employeeID" matches your hierarchy.

See here for info/PDF on referencing objects: http://assure.ly/kUP02y.

Niall

Avatar

Former Community Member

Thanks..

I got it going.

i think i did something like you suggested.

now it's onto another part of the project.