Quantcast
Channel: Sage 100
Viewing all articles
Browse latest Browse all 36993

Forum Post: Sage 100 Script Lines / Grid Refresh

$
0
0
I have a script I'm trying to put together that when a jobno is changed on a purchase order the script will update all the lines below it with that same jobno.  When the post-validate event for the field fires I set my storage variable for the line key and the jobno selected.  Then on the post-write of the line I loop thru the lines object and when I find a line key greater than the one I was on I set the jobno. All this works perfectly, the problem I have is getting the grid to update so you can see the new jobno on the records below the one that it was just changed on.  I can go to the totals tab and then come back and I can see that they are all changed.  But to tell the team sorry you have to just trust me it update the lines isn't really a good answer so I thought I could refresh the grid to show the correct updated jobno.  At this point I have no hair left on my head trying to figure this out.  Any help is appreciated.  Maybe I can't update the grid, it just seems like something I should be able to do... myretVal = 0 myCurrentLineKey = "" myJobNumber = "" myLoopLineKey= "" myReplacementLineKey = "000000" myReplacementJobNo = "BLANK" If oBusObj.EditState = 1 AND oSession.Updating=0 Then oUIObj = oScript.UIObj SET oUIObj = oSession.AsObject(oUIObj) retVal = oScript.DeactivateProcedure("*ALL*") myretVal = oScript.GetStorageVar("CurrentLineKey$",myCurrentLineKey) myretVal = oScript.GetStorageVar("CurrentJobNo$",myJobNumber) IF myJobNumber "BLANK" THEN 'We now have the current line key myretVal = oBusObj.MoveFirst DO WHILE NOT CBool(oBusObj.EOF) myretVal = oBusObj.GetValue("LineKey$",myLoopLineKey) myretVal = oScript.DebugPrint(myLoopLineKey) IF myLoopLineKey myCurrentLineKey THEN myretVal = oBusObj.SetValueNovalidate("JobNo$",myJobNumber) myretVal = oBusObj.Write oScript.LinesAdded =1 'myretVal = oScript.DebugPrint(oBusObj.lasterrormsg) END IF 'Find line key was greater than so update the job cost field myretVal =oBusObj.MoveNext LOOP myretVal = oScript.SetStorageVar("CurrentLineKey$",myReplacementLineKey) myretVal = oScript.SetStorageVar("CurrentJobNo$",myReplacementJobNo) oScript.LinesAdded =1 myretVal = oScript.LoadGrid("GD_Lines") myretVal = oUIObj.HandleScriptUI() END IF retVal = oScript.ActivateProcedure("*ALL*") END IF 'making sure object is in editstate and not updating

Viewing all articles
Browse latest Browse all 36993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>