Page 1 of 2

Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 8:37 am
by DannyC
In the quote module I have made the History column in grdLines MaxLength = 1000.

I've also increased the SQL column QO_Lines.HistoryText_Comment to varchar(1000)

All good & working nicely.

I have made the same changes to sales orders, i.e. extend the MaxLength of the History column in grdLines to 1000 & changed the SQL to varchar(1000).
When I make a sales order from the quote, the comment text comes across nicely. All good - until I save the sales order & I'm truncated to 200 chars.

Is there something I am missing in the sales orders which isn't there in quotes?

my plugin attached
version 7.2.1. SR21

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 11:39 am
by Mike.Sheen
After importing your plugin and running the SQL in the Bigger Details.txt attached as a document (which is missing the ALTER TABLE for SO_Lines, by the way) - exit and log back in I cannot enter a comment > 200 characters in quotes or sales orders - so in my testing your plugin so far does nothing - I'm testing in 7.2.1.22

So, I'm struggling to get to this part, not even looking at the issue of making a sales order from a quote:

All good & working nicely.


So what am I missing?

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 11:59 am
by DannyC
which is missing the ALTER TABLE for SO_Lines, by the way

Yeah I know - yet to edit the document.

So what am I missing?

LOL no idea! There might be a restriction on the typed entry of a comment?

What I am doing is putting in a really big inventory details (Aux3. Up to 1000 chars) and when that partno is added to a quote, the details come through as a comment.
Then that comment should flow through to a sales order (it does) but saving truncates.

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 12:04 pm
by Mike.Sheen
You're setting the column with the caption "History" to have a MaxLength, but that is not where comments are displayed - it's actually the column with the Key "PartNo".

For example, on the quote form you would want to do something like:
Code: Select all
((FarPoint.Win.Spread.CellType.TextCellType)salesQuoteForm.grdLines.ActiveSheet.Cells[salesQuoteForm.grdLines.ActiveSheet.Columns["PartNo"].Index, Row].CellType).MaxLength = 1000;


But your plugin isn't doing anything like that and so far it does nothing to expand the PartNo cell MaxLength for comment lines.

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 2:33 pm
by DannyC
your plugin ... does nothing to expand the PartNo cell MaxLength for comment lines.


I thought this would be an easy edit but I am having trouble expanding the PartNo cell for comment lines.

I've tried
Code: Select all
for (int r = 0; r < salesOrderForm.grdLines.ActiveSheet.RowCount; r++)
{
   ((FarPoint.Win.Spread.CellType.TextCellType)salesOrderForm.grdLines.ActiveSheet.Cells[salesOrderForm.grdLines.ActiveSheet.Columns["PartNo"].Index, r].CellType).MaxLength = 1000;
}


but that hasn't helped.
Also tried the lines.Adding event but that throws an error "Invalid row index: 2 (must be between 0 and 1)'"

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 4:52 pm
by Mike.Sheen
DannyC wrote:
I thought this would be an easy edit but I am having trouble expanding the PartNo cell for comment lines.


The DisplayLine method of sales order and quotes explicitly sets the MaxLength property of the PartNo cell to be 200. It needs to do this, because we don't know if it is a normal part with a max length of 50 or a comment line with a max length of 200, and because we need to create a cell type for the comment dynamically as it also wants cell spans that we do not want when it is not a comment line.

Perhaps listening to the LineDisplayed event (which is invoked by DisplayLine) and setting the MaxLength property will help.

Without actually doing this myself I don't know what you exactly need to do.

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 6:35 pm
by DannyC
Getting closer I think?

I'm hooking into the LineDisplayed event:
Code: Select all
salesOrderForm.LineDisplayed += Danny_ExpandSalesComment;


And that routine looks like
Code: Select all
private void Danny_ExpandSalesComment (object sender, System.EventArgs e, JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine soLine, int Row)
{
   JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm salesOrderForm = (JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm)sender;
   if (soLine.CommentLine)
   {
      ((FarPoint.Win.Spread.CellType.TextCellType)salesOrderForm.grdLines.ActiveSheet.Cells[salesOrderForm.grdLines.ActiveSheet.Columns["PartNo"].Index, Row].CellType).MaxLength = 1000;
   }
}


But getting error 'Object reference not set to an instance of an object.'
I've tried a few different workarounds - was wondering if "PartNo" is actually the caption but no, tried that and still get the error.

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 6:45 pm
by Mike.Sheen
DannyC wrote:But getting error 'Object reference not set to an instance of an object.'


Have you tried to isolate which part is the null reference?

If you have not already, install Visual Studio community edition. Open the .cs file of the plugin in the %ProgramData% folder - the Compile subfolder - eg: C:\ProgramData\Jiwa Financials\Jiwa 7\7.2.1\mike\localhost\JiwaDemo721\Plugins\Admin\Compile\Attkey Sales Quote Get PartNo details\Attkey Sales Quote Get PartNo details.cs

Whilst Jiwa is running, select Debug -> Attach to process and select the Jiwa.exe process. Put a breakpoint in your plugin where you want to stop and inspect - in this case the start of the Danny_ExpandSalesComment method.

Trigger the code being run by performing the required actions in Jiwa - when the breakpoint is hit, you can inspect variables values to work out where the 'Object reference not set to an instance of an object' error is coming from.

Re: Make sales order comments bigger

PostPosted: Tue Nov 18, 2025 10:25 pm
by DannyC
If you have not already, install Visual Studio community edition


Have been debugging with VS for a few years now so, yeah - familiar with that. But I'm not a great expert.

Screen shot Bear in mind that I have tried with "PartNo" and "Part No."
err.jpg


err2.jpg

Re: Make sales order comments bigger

PostPosted: Wed Nov 19, 2025 9:56 am
by Mike.Sheen
DannyC wrote:Screen shot Bear in mind that I have tried with "PartNo" and "Part No."


So you've confirmed it's the salesOrderForm.grdLines.ActiveSheet.Columns["PartNo"] which is returning null and causing the exception? If not, do that - that was the point - to work out exactly what is the cause.

There definitely is a column with the tag PartNo - and so .Columns["PartNo"] should not be returning null, but I cannot see what else could be causing the exception. Maybe you are trying to retrieve the column before it has been added to the grid - like on form load - where are you getting the exception - has the form loaded and displayed yet?