Tim W Posted July 6, 2006 Posted July 6, 2006 Hi, I am trying to copy a child record from one parent record to another. Example, John's time worked is the same as Tom's, so copy John's time detail for Tom's time worked. Setting on Tom's time record, the one after John's, I want to id the previous record serial. Seems to me to be a good use of GetNthRecord. So I try the following: Set Variable [$$TimeSheetID; Value:GetNthRecord (Time_Sheets::Serial; -1)] I can perform the process manually, but when data viewer reaches this statement it evaluates ? Sounds to me like type mismatch but all fields involved are text fields. Any ideas?? Tim
LaRetta Posted July 6, 2006 Posted July 6, 2006 (edited) It might be better to approach it from the other end ... Instead of assigning the TimeSheetID - which should be auto-enter (do not modify) serial, you might go to TimeSheet table, or get there via script after picking up the new StaffID (John). Then just duplicate Tom's TimeSheet which will reflect Tom's StaffID but it will assign a NEW auto-enter TimeSheetID all by itself. All you'll need to change is the StaffID from Tom's to John's. UPDATE: I would be cautious about duplicating TimeSheet information. Working with employee time is serious stuff. Is this one-time thing or for migration? If for regular use, I'd be sure this puppy is very tightly controlled and validated. But it still might expose you to business concerns that *I* wouldn't want to deal with. I suggest a good audit trail ... :wink2: Edited July 6, 2006 by Guest Added update
Tim W Posted July 6, 2006 Author Posted July 6, 2006 One more point, this is a timesheet checking solution, not the critical data that leads to net pay. However, such is my life, accountants need data manipulated also. Bear in mind I am only setting a variable in the above step. This variable will be in turn used as a find criteria in the child file (sorry v6 talk, I mean table) to isolate the records from the previous individuals time detail. Upon further consideration, the problem could be in the process of inserting the variable into the find. Those steps go as follows: Go To Layout [childtable] Show All Records Enter Find Mode [] Insert Calculated Result [Child::SerialKey; $$timesheetID] Perform Find [] This is where the data inserted is a < ? > Maybe this describes the issue better. It's hard to give enough detail the first time. Tim
LaRetta Posted July 6, 2006 Posted July 6, 2006 Setting on Tom's time record, the one after John's, I want to id the previous record serial. You've given me no perspective of your tables or process. Using descriptors such as [color:green]Go To Layout [childtable] and [color:green][Child::SerialKey; $$timesheetID] doesn't tell me how Tom and John are related to the individual time records. I thought THAT would be the child (time records), joined to Tom/John (table name never known). You should NOT be setting a unique ID in a table and all you've provided (to my knowledge) are unique IDs. Does the TimeSheetID uniquely identify Tom from John? If so, then I follow you again. Because I thought the TimeSheetID was unique to the child (time) records. I think a simple GTRR (Go To Related Records[]) might be what you seek but I'm still unclear on what you are truly seeking. Can you explain a bit more (from the User perspective) as well? :wink2:
Tim W Posted July 6, 2006 Author Posted July 6, 2006 LaRetta, Yes a simple GTRR just might do the trick. Serial in the child(foreign Key) is set based on TimeSheetID (primary key in header table), which is unique for each person. A picture is worth a thousand words so I attached a screen shot of the entry form. I think I will use GetNthRecord for another day, and investigate this from another direction. Thanks for the help, sometimes I find the solution by trying to explain the problem. Tim TimeSheetView.pdf
Recommended Posts
This topic is 6717 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now