esings2him
Programmer
Hi all! I have a report that has parent and child jobs that need to be linked to the top most job. The parent job is linked to the top most job; however, the children are not. I have a formula that groups all of the parent and child jobs together and I, also, have a formula that groups parent and child jobs to the top most job. For some reason, the top most job is not linking on the correct child jobs on some of the jobs. Here are my formulas and data below:
Formulas:
@Job Number
If instr({PartTran.JobNum}, "-") =0 then {PartTran.JobNum} else
split({PartTran.JobNum}, "-")[1]
@GP Job
WhileReadingRecords;
global stringvar GPJob;
If {@Job Number} <> {JobProd.TargetJobNum} then GPJob:= {JobProd.TargetJobNum}
else
If {@Job Number} = {JobProd.TargetJobNum} then GPJob:= GPJob
Incorrect Data:
1058
SO# JobNum TargetJobNum @GPJob @JobNum
0 1058 TVDB-0000103-1 TVDB-0000103-1 1058
0 1058-EM208 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
1059
0 1059-PM205 1059 TVDB-0000103-1 1059
0 1059-EM201 1059 TVDB-0000103-1 1059
0 1059-BM503 1059 TVDB-0000103-1 1059
0 1059-TM208 1059 TVDB-0000103-1 1059
0 1059-BM503 1059 TVDB-0000103-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
How it should appear:
1058
SO# JobNum TargetJobNum @GPJob @JobNum
0 1058 TVDB-0000103-1 TVDB-0000103-1 1058
0 1058-EM208 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
1059
0 1059-PM205 1059 TVDB-0000106-1 1059
0 1059-EM201 1059 TVDB-0000106-1 1059
0 1059-BM503 1059 TVDB-0000106-1 1059
0 1059-TM208 1059 TVDB-0000106-1 1059
0 1059-BM503 1059 TVDB-0000106-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
How to correct this problem? Thanks!
Formulas:
@Job Number
If instr({PartTran.JobNum}, "-") =0 then {PartTran.JobNum} else
split({PartTran.JobNum}, "-")[1]
@GP Job
WhileReadingRecords;
global stringvar GPJob;
If {@Job Number} <> {JobProd.TargetJobNum} then GPJob:= {JobProd.TargetJobNum}
else
If {@Job Number} = {JobProd.TargetJobNum} then GPJob:= GPJob
Incorrect Data:
1058
SO# JobNum TargetJobNum @GPJob @JobNum
0 1058 TVDB-0000103-1 TVDB-0000103-1 1058
0 1058-EM208 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
1059
0 1059-PM205 1059 TVDB-0000103-1 1059
0 1059-EM201 1059 TVDB-0000103-1 1059
0 1059-BM503 1059 TVDB-0000103-1 1059
0 1059-TM208 1059 TVDB-0000103-1 1059
0 1059-BM503 1059 TVDB-0000103-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
How it should appear:
1058
SO# JobNum TargetJobNum @GPJob @JobNum
0 1058 TVDB-0000103-1 TVDB-0000103-1 1058
0 1058-EM208 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
0 1058-TM211 1058 TVDB-0000103-1 1058
1059
0 1059-PM205 1059 TVDB-0000106-1 1059
0 1059-EM201 1059 TVDB-0000106-1 1059
0 1059-BM503 1059 TVDB-0000106-1 1059
0 1059-TM208 1059 TVDB-0000106-1 1059
0 1059-BM503 1059 TVDB-0000106-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
0 1059 TVDB-0000106-1 TVDB-0000106-1 1059
How to correct this problem? Thanks!