This process is using hr-history.emp_unum_supv to find the supervisor, but DCX program doesn't send either hr-history.supv-emp-id or hr-history.emp_unum_supv.
A check is needed when looking for the supervisor info. If the emp_unum_supv is blank, then try supv-emp-id. If both are blank, then use the claimadr w/ addr-type = 'SUP'.
/* supervisor info */
IF AVAILABLE hr-history THEN
FIND bf-hr-master
WHERE bf-hr-master.cont-num EQ claim.cont-num
AND bf-hr-master.emp_unum EQ hr-history.emp_unum_supv
AND bf-hr-master.deleted EQ FALSE
NO-LOCK NO-ERROR.
IF AVAILABLE hr-history AND AVAILABLE bf-hr-master AND
bf-hr-master.first-name + bf-hr-master.last-name <> "" THEN
ASSIGN
tt-data-tble.sup-f-name = bf-hr-master.first-name
tt-data-tble.sup-l-name = bf-hr-master.last-name
tt-data-tble.sup-phone = fnFormatPhone(bf-hr-master.w-phone).
ELSE DO:
FIND FIRST claimadr OF claim WHERE
claimadr.addr-type = "SUP" NO-LOCK NO-ERROR.
IF AVAILABLE claimadr THEN
ASSIGN
tt-data-tble.sup-f-name = claimadr.first-name
tt-data-tble.sup-l-name = claimadr.last-name
tt-data-tble.sup-phone = fnFormatPhone(claimadr.phone1).
END.
I have tried everything I can think of to solve this but it seems that my logic is seriously flawed. This is the last solution I could think of and it does’t work either.
IF AVAILABLE hr-history THEN
FIND bf-hr-master
WHERE bf-hr-master.cont-num EQ claim.cont-num
AND bf-hr-master.emp_unum EQ hr-history.emp_unum_supv
AND bf-hr-master.deleted EQ FALSE
NO-LOCK NO-ERROR.
ELSE
IF NOT AVAILABLE hr-history THEN
FIND bf-hr-master
WHERE bf-hr-master.cont-num EQ claim.cont-num
AND bf-hr-master.emp_id EQ hr-history.supv-emp-id
AND bf-hr-master.deleted EQ FALSE
NO-LOCK NO-ERROR.
IF AVAILABLE hr-history AND AVAILABLE bf-hr-master AND
bf-hr-master.first-name + bf-hr-master.last-name <> "" THEN
ASSIGN
tt-data-tble.sup-f-name = bf-hr-master.first-name
tt-data-tble.sup-l-name = bf-hr-master.last-name
tt-data-tble.sup-phone = fnFormatPhone(bf-hr-master.w-phone).
ELSE DO:
FIND FIRST claimadr OF claim WHERE
claimadr.addr-type = "SUP" NO-LOCK NO-ERROR.
IF AVAILABLE claimadr THEN
ASSIGN
tt-data-tble.sup-f-name = claimadr.first-name
tt-data-tble.sup-l-name = claimadr.last-name
tt-data-tble.sup-phone = fnFormatPhone(claimadr.phone1).
END.
I have tried so many possible solutions but I cannot seem to get the right logic for this.
>> This process is using hr-history.emp_unum_supv to find the supervisor, but DCX program doesn't send either hr-history.supv-emp-id or hr-history.emp_unum_supv.
As I don't have clear your tables, my only suggestion is to use on several points of your program
MESSAGE "hr-history:" AVAILABLE hr-history VIEW-AS ALERT-BOX.
etc .. similar for the other tables ...
Probably you can track where is the problem ...
btw, you said "If the emp_unum_supv is blank, then try supv-emp-id"
I don't see on your code that check, you are checking the frist and last name, not the id.
Ok I apologize that makes since Brian thanks. Marco thanks for the suggestions and I think that I may have the right solution now that I see the check is for first and last names. Thanks guys.