Reputation: 1073
I have the following code which should do a simple if-else statement using Progress ABL.
I cannot get the program to reach the ELSE statement even when the substring "UK" cannot be found. Can anyone see what I am missing:
FIND FIRST ttShipHead WHERE ttShipHead.ShipToCustCustID = "1404".
IF ttShipHead.AddrList Matches "*UK*" THEN
assign ttShipHead.CheckBox01 = (false).
ELSE
assign ttShipHead.CheckBox01 = (true).
Upvotes: 0
Views: 5373
Reputation: 380
Your code looks correct. Maybe some small changes to make sure you have record.
FIND FIRST ttShipHead WHERE ttShipHead.ShipToCustCustID = "1404" NO-ERROR.
IF AVAILABLE ttShipHead THEN
IF ttShipHead.AddrList MATCHES "*UK*":U THEN
assign ttShipHead.CheckBox01 = (false).
ELSE
assign ttShipHead.CheckBox01 = (true).
if you want to can add and else to show if record not available.
FIND FIRST ttShipHead WHERE ttShipHead.ShipToCustCustID = "1404" NO-ERROR.
IF AVAILABLE ttShipHead THEN
IF ttShipHead.AddrList MATCHES "*UK*":U THEN
assign ttShipHead.CheckBox01 = (false).
ELSE
assign ttShipHead.CheckBox01 = (true).
ELSE
MESSAGE "NO RECORD FOUND".
Upvotes: 0
Reputation: 14020
I suggest that you add some debugging:
FIND FIRST ttShipHead WHERE ttShipHead.ShipToCustCustID = "1404" no-error.
message available( ttShipHead ).
pause.
message ttShipHead.AddrList ( ttShipHead.AddrList Matches "*UK*" ).
pause.
IF ttShipHead.AddrList Matches "*UK*" THEN
assign ttShipHead.CheckBox01 = (false).
ELSE
assign ttShipHead.CheckBox01 = (true).
message ttShipHead.Checkbox01.
pause.
This should make it clear what is going wrong.
Upvotes: 1
Reputation: 3251
If there's a message on the screen about record ttshiphead not found, then it's not running the IF statement at all.
Typically FINDs have a "NO-ERROR" followed by an "IF AVAILABLE ttshiphead THEN " where required.
Upvotes: 0
Reputation: 90
I don't know a whole lot about ABL. But I think the syntax is IF expression THEN DO: work. So try adding a DO: after your THEN
Upvotes: 0