BPM Help - problem interpreting checkboxes

I’m working on a BPM in Vantage 8 that is “supposed” to check on update of any ECOMTL record to see if the part number on the BOM is marked in the Part Master as Inactive = True. Only thing is it doesn’t work. It’s like it’s ignoring the ‘if’ statement where I check the Part.Inactive status field = true.

Code:

/* Define Variables */
def var vc-Warning as char no-undo.
def var myText as char no-undo.

/* Search for current record being added or updated in the table */
FOR EACH ttECOMtl WHERE (ttECOMtl.rowmod = “A” OR ttECOMtl.rowmod = “U”) NO-Lock:
IF AVAIL ttECOMtl THEN DO:
myText = ‘Stop 1 Found ttECOMtl Record Added or Updated’.
{lib/PublishInfoMsg.i &InfoMsg = myText &InfoSeverity = {&MESSAGE_INFO}}

/* Find where meets condition */
	for each Part WHERE Part.Company = ttECOMtl.Company AND 
											Part.PartNum = ttECOMtl.PartNum No-LOCK.

		/* If found proceed */
		IF AVAIL Part THEN Do:
					myText = 'Stop 2 Found the Part'.
					{lib/PublishInfoMsg.i &InfoMsg = myText &InfoSeverity = {&MESSAGE_INFO}}.

                                            /* Check the Parts Inactive Status; if TRUE then Error */
					if Part.Inactive = TRUE then do:
							myText = 'Stop 3 Found the Part and the Part is Inactive (True)'.
							{lib/PublishInfoMsg.i &InfoMsg = myText &InfoSeverity = {&MESSAGE_INFO}}

							vc-Warning = 'Error! The Part entered is Inactive - Invalid for Engineering Workbench BOM Selection'.
							{lib/PublishEx.i &ExType = {&MESSAGE_ERR} &ExMsg = vc-Warning}
					end. /* End if available Part */

		end.  /* If Avail Part */

	end. /* For each part */

END. /* End outter IF ttECOMTL */

END. /* FOR EACH */

Never mind - figured it out. Just my silly coding mistake. Should be reading the part record with the MtlPartNumber and not the PartNum field.

1 Like