Sage 100

 View Only
  • 1.  Script to disable fields in SO Entry Lines grid

    Posted 08-19-2021 18:30
    Is it possible to disable fields like the Unit Price within a grid with scripting? I can see how to hide and disable non-grid controls and tabs but am not finding anything related to grid controls. Client wants to disable certain SO Entry line entry fields if an item is not eligible for discounts. Thanks in advance!

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------


  • 2.  RE: Script to disable fields in SO Entry Lines grid

    Posted 08-20-2021 09:58
    Grid scripts are horribly temperamental.  I've done this kind of thing a different way, with a pair of scripts.
    • Capture the Original Unit Price in a UDF (column post validate on quantity, only set when the UDF is blank, so only the first non-zero value is captured).
    • Then column post validate on UnitPrice... with IsMember check and any other kind of filters you wish.  When the value entered is less than the Original Unit Price: SetError.


    ------------------------------
    Kevin Moyes
    Technical Systems Analyst
    Munjal White Consulting Co.
    Toronto ON
    ------------------------------



  • 3.  RE: Script to disable fields in SO Entry Lines grid

    Posted 08-20-2021 15:01
    I agree with Kevin. Another reason to avoid is because with S/O Entry they will keep asking for more of this when you do get it to work. The issues with changing grid cell/column/row control states are all about the timing. E.g. If you disable UnitPrice on the Panel PostLoad of PLines as a UI script, the system may then re-enable it after your script completes making you think your script didn't work. You could then try to re-disable UnitPrice when user clicks on the line but PostRead isn't a UI event (which is what you really need and not available to scripting on grids) so it may not work. If it does work, you results may not be consistent.

    If you study it hard enough most likely you will figure out something that works but remember you have to support it on future versions too and there is always that good chance the customer will ask you to further enhance your logic.

    It's not as temperamental to color rows and cells (if you have all your events covered) but what's even easier is to do what Kevin suggested. You could use SetStorageVar and GetStorageVar instead of UDF if you wanted.

    ------------------------------
    Alnoor Cassim

    Email: alnoor@asifocus.com
    Ph: 949-689-9887
    Orange County, CA
    ------------------------------



  • 4.  RE: Script to disable fields in SO Entry Lines grid

    Posted 08-20-2021 15:22
    Thank you both! This client does have a number of other SO_Detail scripts that are running and I really didn't want to add another one. I will let them know I really just can do a warning that the item price should not be changed rather than trying to disable fields.

    ------------------------------
    Amber Prayfrock, Blytheco
    ------------------------------