Notes, Tips and Tricks on Developing in Dynamics GP
From a recent email:
Have you ever written anything to control the format that the Line Item Comment (from SOP)? Example, Customer wants to force a return after 40 characters of typing
===================
I’m doubtful this is possible, because of the way that Dynamics handles comments internally. Key in a long comment, and then look at the SOP10106 table. There are 5 fields – comment_1 through 4 and cmmttext. Cmmttext holds the full, unaltered comment, the other comment fields hold parsed versions of this, 5 characters each. If you key a 250 character comment, the last 50 chars (at least) will not display in some situations. Some forms display the entire CMMTTEXT field (like the SOP Transaction Entry form), some display the parsed comment_1 (etc) fields (like the Invoice report). We could try to set a trigger on the SOP10106 that ‘reparsed’ the other fields on every update… but convey to the customer the risk. I’ve never tried it and I’m unsure of the results. I would grab the CMMTTEXT field, count 40 characters, then walk backward and look for the last ‘word end’ character (usually a space). I’d repeat that 4 times. I’d have to do some research into whether the CMMTTEXT field stores non-visible line feed characters (caused by someone intentionally hitting ‘enter’ in a comment field), and handle that if it did.
About Steve Gray
Steve is a seasoned (translate: old) developer in VB and ASP.NET. He spends most of his time in Dynamics GP, writing custom mods for consulting firms. Crystal reports, eConnect, VS Tools for Dynamics... anything that comes along.