Sage 100

 View Only
  • 1.  UI Script drops first (unsaved line) from Sales Order

    Posted 12-15-2020 10:05
    Experts,

    I have a complex script that fires on the Panel PostLoad event of PLINES in SO Entry. The script colors lines based on some conditions and works great. It is based on a script that I got from @Alnoor Cassim​ in a ScriptingClass a few years ago. The issue with my script (as well as the example script) is that on a new order it will drop the first line item. On an existing order that has been saved before, it will drop the first new line if you add additional lines. The script loops through the lines.

    Does anyone know how to prevent this behavior?

    Thanks,

    Bastian

    ------------------------------
    Bastian Boesner-Worth
    Regional Consulting Manager
    SWK Technologies Inc.
    East Hanover NJ
    973-396-1721
    ------------------------------


  • 2.  RE: UI Script drops first (unsaved line) from Sales Order

    Posted 12-15-2020 10:08
    Does the script actually drop the lines, or does it just not show them in the UI?  If it's just display, there is a button script refresh idea you could try.

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



  • 3.  RE: UI Script drops first (unsaved line) from Sales Order

    Posted 12-15-2020 10:46
    It actually drops the line. I think moving around in the lines object messes up the proper focus. In the UI it shows correctly, but then once you go to the TotalsTab and back, it's gone.

    ------------------------------
    Bastian Boesner-Worth
    Regional Consulting Manager
    SWK Technologies Inc.
    East Hanover NJ
    973-396-1721
    ------------------------------



  • 4.  RE: UI Script drops first (unsaved line) from Sales Order

    Posted 12-15-2020 10:58
    I used this once to fix the UI falling out of line with the Lines object in a UI script.
    sLoadKey = ""
    sLoadKey = oLines.GetKey()
    ...
    if sLoadKey<>"" Then
       retVal = oLines.SetKey(sLoadKey)
    End If


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



  • 5.  RE: UI Script drops first (unsaved line) from Sales Order

    Posted 12-15-2020 12:56
    I had that in my script and then took it out for testing. Unfortunately, it doesn't make a difference.  If I set key back to what it was or not, doesn't make a difference.

    Is there a method to save all uncommitted lines first?

    ------------------------------
    Bastian Boesner-Worth
    Regional Consulting Manager
    SWK Technologies Inc.
    East Hanover NJ
    973-396-1721
    ------------------------------



  • 6.  RE: UI Script drops first (unsaved line) from Sales Order

    Posted 12-15-2020 14:59
    I'd add pop-ups / debug text to walk through the line keys active with each loop iteration to back trace what's happening.
    Each line is written one at a time, but nothing is committed to the database until the header write.

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



  • 7.  RE: UI Script drops first (unsaved line) from Sales Order

    Posted 12-16-2020 12:24
    Are you sure you're triggering a new line before starting to SetValue / Write... within the loop?

    retVal = oLines.AddLine()

    It could be that the line is not being dropped, and it is simply being overwritten with new values (so it only seems like it is being dropped).

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



  • 8.  RE: UI Script drops first (unsaved line) from Sales Order

    Posted 12-17-2020 17:34

    Kevin,

    I added the

    retVal = oLines.AddLine()

    to the end of my script, and now it works.

    Thanks so much!



    ------------------------------
    Bastian Boesner-Worth
    Regional Consulting Manager
    SWK Technologies Inc.
    East Hanover NJ
    973-396-1721
    ------------------------------