RT Posted September 24, 2009 Posted September 24, 2009 (edited) hi i have read and searched and tried many scripts to do this my problem is my loop script works but it inserts the time entries from the portal to the same JOB_id number and not the new Job ID i think the problem is it is duplicating the line items which already has a JobID assigned to it, so my script need to ignore this previous Job_id number when it duplicates how do i do that here is the script i just cannot chain everything together in my head Go to Layout [ “Job Entry” (JOB__Job.tog) ] Go to Related Record [ From table: “job.TIM_TimeEntry”; Using layout: “TimeEntry_list” (TIM__TimeEntry.tog) ] [ Show only related records ] Go to Layout [ “Job Entry” (JOB__Job.tog) ] Duplicate Record/Request Perform Script [ “Duplicate Portal”; Parameter: tim.JOB_Job::zkf_employeeID.n ] Go to Layout [ “Job Entry” (JOB__Job.tog) ] here is the second script. Duplicate Portal Duplicate Portal Go to Layout [ “TimeEntry_list” (TIM__TimeEntry.tog) ] Loop Duplicate Record/Request Set Field [ job.TIM_TimeEntry::zkf_EmployeeID.n[ Get(ScriptParameter)] ] Omit Record Go to Record/Request/Page [ First ] Omit Record Exit Loop If [ Get(FoundCount) = 0 ] End Loop thanks for looking. Edited September 24, 2009 by Guest
IdealData Posted September 25, 2009 Posted September 25, 2009 (edited) In your first script you need to capture the JobID in a $$var and then use $$var to set the JobID for the time entries in the second script. Err.. just noticed you are effectively doing that with the script parameter. Edited September 25, 2009 by Guest
IdealData Posted September 25, 2009 Posted September 25, 2009 Is the JobID field in the time entries table writeable?? Serial numbers are often set to dis-allow modification. Use the script debugger to expose any errors.
comment Posted September 25, 2009 Posted September 25, 2009 I don't see that your script handles JobID at all - I believe it's just being duplicated along with the rest of the fields. The only thing that is being modified is the EmployeeID (not sure why). It's not at all clear where the new JobID is supposed to come from - shouldn't you create a new job record first?
RT Posted September 25, 2009 Author Posted September 25, 2009 thanks for all your suggestions. i have spent the last 4 hours but still not working i have included a file if anyone has time to look at it. just go to jobs run the script "dupe portals job" with the debugger on. if you need to access to full menus hit scripts/menu button. i have tried to remove as much of the data and files username: fm userpass: forums if this can be done it will save me 3 hours a week in boring data entry. The developer is now the Secretary : port_dupe.zip
RT Posted September 30, 2009 Author Posted September 30, 2009 i am still trying to get this going i even tried setting a variable (jobid) when i duplicate the master record and inserting that variable into the child ( time enty) but it still appears on the original job. any help with the script would be helpfull :help:
Vaughan Posted September 30, 2009 Posted September 30, 2009 Is the master record set to generate the serial number on creation or on commit? If it's on commit, it may still have the "old" number in it.
RT Posted September 30, 2009 Author Posted September 30, 2009 the master record is set on creation but the line items from time entries are keeping the old job_id si it puts these line items into the original job very confusing for me
Søren Dyhr Posted September 30, 2009 Posted September 30, 2009 It might be difficult to spot, but if you look at the error code 111 ... you are setting repetition number acheived from the scriptparameter to void. There is no need to write voids to a specific repetition not existing. --sd
RT Posted September 30, 2009 Author Posted September 30, 2009 thanks for looking Soren. but i cannot understand your message to advanced for me. as you can se in the screenshot the script runs perfect until get to this step where i need to insert then new Job ID into the duplicated line item.
Søren Dyhr Posted September 30, 2009 Posted September 30, 2009 (edited) Set field has two parts, you have accidentally put the script parameter to direct which repetition to address, but what you need is to put the script parameter in via the second button in the set field dialog, instead of using the repeating option in the button above ... look at the image! I attach the corrected files as well: --sd port_dupe-1.zip Edited September 30, 2009 by Guest
RT Posted September 30, 2009 Author Posted September 30, 2009 thanks for helping Soren. i see what you mean but when the master job (13) is duplicated for this example it gives an id of 14 but still all the time entries (lineitems) still get the jobID of 13 instead of 14 so when the script goes to the last step job layout it is still empty. :confused:
RT Posted October 4, 2009 Author Posted October 4, 2009 i have fixed my script, it was very complicated in the end, lots of variables and deleting job_ids linked to customers_id and Invoice_ids and time_entry_ids. and then the loops. :thankyou:
Recommended Posts
This topic is 5530 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