Set selection criteria for a customer number in a BOI executed report

This is something of a follow up on a project inspired by my assistance on another thread.

Essentially the goal is to print a mailing label directly from customer maintenance by clicking on a button when in that customer.   Everything works just fine with the exception of selecting the specific customer -  I always get ALL customers - not the one requested.   I believe the  problem comes from the fact that a customer number is actually made up of the division number and the customer number

The value for FullCustomerNo below is previously obtained in the script.  In my testing I have confirmed that I am getting 00ORANGE  (i.e. no dash in the full customer number).

' Set Selection criteria
retVal = ARLABELPRINT.SetValue("SelectField$", "Customer Number")     ;  I had concluded that these are the names you would see in the mailing label dialogs,  I'm not really clear why there are two values for what seem to be the same thing?

retVal = ARLABELPRINT.SetValue("SelectFieldValue$", "Customer Number")  

retVal = ARLABELPRINT.SetValue("Tag$", "TABLE=AR_CUSTOMER; KEYREFERENCE=<ARDivisionNo$+CustomerNo$>;") 

retVal = ARLABELPRINT.SetValue("Operand$", "=")
retVal = ARLABELPRINT.SetValue("Value1$", FullCustomerNo)

retVal = ARLABELPRINT.Write()

 retVal = oSession.AsObject(oSession.UI).MessageBox("About to print")

retVal = ARLABELPRINT.ProcessReport("PREVIEW")

Can anyone clear up my confusion?

  • 0

    Tom,

    I believe you will want to set 'SelectField$' to "<CUSTOMER>". You will then want to add a line before Write:

    retVal = ARLABELPRINT.nSetValue("KeyReference$", "<ARDivisionNo$+CustomerNo$>")

    You should wind up with something like:

    retVal = ARLABELPRINT.SetValue("SelectField$", "<CUSTOMER>")

    retVal = ARLABELPRINT.SetValue("SelectFieldValue$", "Customer Number")  

    retVal = ARLABELPRINT.SetValue("Tag$", "TABLE=AR_CUSTOMER; KEYREFERENCE=<ARDivisionNo$+CustomerNo$>;")

    retVal = ARLABELPRINT.SetValue("Operand$", "=")

    retVal = ARLABELPRINT.SetValue("Value1$", FullCustomerNo)

    retVal = ARLABELPRINT.SetValue("KeyReference$","<ARDivisionNo$+CustomerNo$>")

    retVal = ARLABELPRINT.Write()

    retVal = oSession.AsObject(oSession.UI).MessageBox("About to print")

    retVal = ARLABELPRINT.ProcessReport("PREVIEW")

    I'm not able to test this right now, but this should put you in the right direction.

    Mickey

  • 0 in reply to Mickey Wright

    Thanks Mickey.

    Something is still not quite right.  

    I am getting a pop up when the Write() command executes.  "The record is not in an editable state".

    Then it proceeds to print all customers.