Is the "not numeric" message accompanied with a returned value indicating failure or a warning? I usually don't worry about the not numeric messages unless I know for a fact the field is restricted to numeric values.
Have you tried oSession.AsObject(oScript.UIObj).ChangeML_Customer() after doing oBusObj.SetValue on ARDivisionNo and CustomerNo?
Did you test the oSession.AsObject(oScript.UIObj).SetControlProperty method?
If all else fails, sounds like you just need to defer the enabling of the control. One way to do this without the extra button is using the UI object SetVar method on the CMD_STR$ variable with the X prefix indicating everything that follows is to be executed.
oSession.AsObject(oScript.UIObj).SetVar "CMD_STR$", "X _obj'SetControlProperty(""ApplyToInvoiceNo"", ""Enabled"", ""1"")"
------------------------------
David Speck II
Tennessee Software Solutions
------------------------------
Original Message:
Sent: 05-24-2022 14:49
From: Dan Burleson
Subject: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'
Thanks David. I've been playing with your suggestion of [r = oSession.AsObject(oScript.UIObj).InvokeChange("ML_Customer", "ABC")] with a company w/o divisions. Since there's no screen field for ARDivisionNo:
- If I set it to just "ABC" I get the error "The division number must be numeric"
- If I set it to "00-ABC" I get the error "The customer number contains an illegal character"
- If I set it to "00ABC" It thinks I want to create a new customer record with the customer number of "00ABC"
- I also tried to preceded the InvokeChange with a setting of the division number in the table: [r = oBusObj.SetValue("ARDivisionNo$", "00")], but get the same "must be numeric" error on the InvokeChange.
Someday I'll need this, but for now I've switched my idea to enabling the SalesOrderNo field to repurpose it for C/M's so I don't require a UDF to input it. Once it's enabled, I'm using a Pre Validate event to grab the SalesOrderNo, lookup the related invoice in history, set the customer, division, ApplyToInvoiceNo, and then clear SalesOrderNo w/SetError) This all works, but only if I enable SalesOrderNo from a button click with the statement [r = oScript.SetUIControl("SALESORDERNO", "ENABLE")]. It doesn't work if I invoke the same button from a UDS with [r = oScript.InvokeButton("BT_LINK_1")]. I get the same return code (0) and no oScript.LastErrorMsg in both cases, it just doesn't enable the field unless I use an actual Button. (???)
------------------------------
Dan Burleson
Software Consultant
Connex Software
------------------------------
Original Message:
Sent: 05-24-2022 10:17
From: David Speck II
Subject: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'
Did you try using oSession.AsObject(oScript.UIObj).InvokeChange on ML_Customer if oScript.UIObj is not equal to 0 in your table script (falling back to oBusObj.SetValue if it is equal to 0)?
Alternatively, did you try [oSession.AsObject(oScript.UIObj).SetControlProperty "ApplyToInvoiceNo", "Enabled", 1] if oScript.UIObj is not equal to 0 in your table script?
------------------------------
David Speck II
Tennessee Software Solutions
Original Message:
Sent: 05-23-2022 21:45
From: Dan Burleson
Subject: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'
I was able to get around this out by invoking a server button script that used:
retVal = oScript.SetUIControl("APPLYTOINVOICENO", "ENABLE")
------------------------------
Dan Burleson
Software Consultant
Connex Software