Click Form Button to Make a File?

I need to click a form button on the Job Entry form to make a file (the file will then be used to print a label). I’ve added a button through customization, but am totally lost on how to get the following data written into a file.

  • Customer
  • Job #
  • Part #
  • Due Date

Does anyone have any somewhat close sample code for me to consider? Any directions on what features to use to make this happen?

Thank you.

I took this from a post processing on scheduleEngine.MoveJobItem. I gutted it and added your tables. It compiles, but has never been run.
The hardest item is customer if you are not make direct and the sales order is not there to link to.

Greg

/* write file after scheduling */

DISABLE TRIGGERS FOR LOAD OF JobHead.
DISABLE TRIGGERS FOR LOAD OF JobAsmbl.
DISABLE TRIGGERS FOR LOAD OF OrderHed.

Def var Customer as Character init ‘’.

For each ttScheduleEngine.

                            message " DEBUG - In Post schedule engine move job " + ttScheduleEngine.JobNum.

            For each Jobhead where JobHead.JobNum = ttScheduleEngine.JobNum and JobHead.Company = cur-comp,
                            Each JobAsmbl where JobHead.JobNum = JobAsmbl.JobNum and JobAsmbl.Company=JobHead.Company and JobAsmbl.AssemblySeq=ttScheduleEngine.AssemblySeq exclusive-lock.

                                            If JobAsmbl.TLEProdHours = 0  then next.

                                            /*
                                            JobHead.JobNum
                                            JobHead.PartNum
                                            JobHead.DueDate
                                            */
                                            For each JobProd where JobProd.Company = cur-comp and JobProd.JobNum = JobHead.JobNum.

                                                            If JobProd.OrderNum = 0 then next.

                                                                                                            For first OrderHed fields ( CustNum ) where OrderHed.Company = cur-comp and OrderHed.OrderNum = JobProd.OrderNum.

                                                                                                                            For first Customer           fields ( name ) where Customer.Company = cur-comp and Customer.CustNum = OrderHed.CustNum.

                                                                                                                                                            Customer = Customer.Name.

                                                                                                                            End.

                                                                                                            End.
                                                            End.

end.

End.

This is incredible!! Thank you.

Question: I am testing running this via the scheduleEngine.MoveJobItem POST method, but is there a way to also run this same code from a “reprint” button on the Job Entry form?

Inside the UI would be C#, so no that code would not work. You could add a checkbox to Job Entry and then on JobEntry.Update test for the checkbox to be true, run the abl code and then unset the checkbox.

Okay, thank you. I’ll poke around a bit with that. Your example has significantly demystified the ABL world for me. Thank you very much.

Greg,

How would I modify those opening ABL query lines to work on JobEntry.Update?

FROM:

For each ttScheduleEngine.
For each Jobhead where JobHead.JobNum = ttScheduleEngine.JobNum and JobHead.Company = cur-comp,
Each JobAsmbl where JobHead.JobNum = JobAsmbl.JobNum and JobAsmbl.Company=JobHead.Company and JobAsmbl.AssemblySeq=ttScheduleEngine.AssemblySeq exclusive-lock.

TO (??)
For each ttJobHead.
For each JobAsmbl where JobHead.JobNum = JobAsmbl.JobNum and JobAsmbl.Company=JobHead.Company exclusive-lock.

(I keep getting errors and can’t figure out what I’m doing wrong)

Thank you.

Wait, I think I got it:

TO:
For each ttJobHead.

For each Jobhead where JobHead.JobNum = ttJobHead.JobNum and JobHead.Company = cur-comp,
	Each JobAsmbl where JobHead.JobNum = JobAsmbl.JobNum and JobAsmbl.Company=JobHead.Company exclusive-lock.

QUESTION: I had to delete the JobAsmbl.AssemblySeq=ttScheduleEngine.AssemblySeq portion. Do I need that? Why did you have it in the original example?

Thank you

I was using JobAsmbl.TLEProdHours=0 to skip the routine if the job was not scheduled yet.

You don’t need JobHead the second time or even JobAsmbl if you are triggering the routine from a checkbox being true, For each ttJobHead will do. Then get JobProd using ttJobHead

Thank you Greg. Your responses have really breathed life into my Epicor journey. I very much appreciate your help.

Your Welcome. I gleaned a lot of stuff out of this group when I started too.

1 Like