Iterate through operations, find where only one certain operation exists

Maybe I’m over thinking this one or just brain dead right now. So I have many jobs that have one or many operations. I am trying to single out jobs which only have a single JobOper.OpCode of “ASSEM”. I am just trying to get assembly only jobs but I’m struggling… Oh Epicor 9.05, so this would be in ABL.

Thank you!
Chris

Why not write a BAQ with a Count per OpCode and filter out anything whrere the count is > 0

Exactly where I am at but for some reason I am struggling with something that should be so simple… lol

Not sure how diff in E9 it is, but in general
image

image

image

For me to do this, the JobOper table must be a summary table which I cannot have. This BAQ/Dashboard is to display all Jobs and their operations. I am trying to set a calculated field to true if there is only one operation where the OpCode equals ASSEM.

Does E9 allow subqueries? If so, you could make a separate query and link it back in

Unfortunately, no. Not until e10.

Awwww drats

Didn’t realize it was part of a dashboard you are kind of out of luck you’ll have to either customize the dashboard to fill in that caculated fied… or use a BPM to flag the records ahead of time. (in 9)

That’s what I am trying to do is write the BPM to set a field to true and then filter by that field in the dashboard.

In my BPM, I should be able to iterate through each operation (for each) within a job with a counter. If it only counts 1 AND that counted operation’s OpCode is “ASSEM” then set my calculated field to true…Just how?

Here’s some info on using aggregates in ABL
https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref/aggregate-phrase.html

Thank you

My brain just unlocked… This was a big duh so sorry for wasting all of your time.

DEF VAR COUNTER AS INTEGER no-undo.

For EACH ttResults no-lock.
COUNTER = 0.

Find FIRST JobHead where JobHead.JobNum = ttResults.JobHead_JobNum no-lock no-error.
	If AVAIL JobHead then DO:
		For EACH JobOper where JobOper.JobNum = JobHead.JobNum no-lock.
				COUNTER = COUNTER + 1.
		End.
		If COUNTER = 1 and JobOper.OpCode = "ASSEM" then ttResults.Calculated_AssemblyOnly = TRUE.
	End.

End.

1 Like