Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5530 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (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 by Guest
Posted (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 by Guest
Posted

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.

Posted

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?

Posted

thanks for all your suggestions.

i have spent the last 4 hours but still not working :confused:

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

Posted

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

:confused::bang: :help:

Posted

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.

Posted

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

Posted

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

set_field.jpg

Posted

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.

screen-capture.jpg

Posted (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

correctbutton.jpg

port_dupe-1.zip

Edited by Guest
Posted

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:

Posted

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. :laugh2:

:thankyou:

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.