Custom Field Sizes  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Custom Field Sizes

Postby SBarnes » Wed Jul 28, 2021 3:14 pm

Is it possible to increase the size of a custom field above the current 255 character limit by simply altering the table such as for inventory?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Custom Field Sizes  Topic is solved

Postby Mike.Sheen » Wed Aug 11, 2021 6:49 pm

SBarnes wrote:Is it possible to increase the size of a custom field above the current 255 character limit by simply altering the table such as for inventory?


The underlying table columns for all our custom field values has the contents to VARCHAR(MAX) which has a 2GB limit on size.

The grid cell type, however, has a default value for the MaxLength property - which is 255 characters.

You can set the MaxLength in the FormatCell method of the CustomFieldPlugin of the plugin which the custom field is defined:

Code: Select all
public void FormatCell(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic BusinessLogicHost, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm FormObject, int Col, int Row, JiwaFinancials.Jiwa.JiwaApplication.IJiwaCustomFieldValues HostObject, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
{            
   if (GridObject.ActiveSheet.Cells[Row, Col].CellType is FarPoint.Win.Spread.CellType.TextCellType)
   {
      FarPoint.Win.Spread.CellType.TextCellType cellType = (FarPoint.Win.Spread.CellType.TextCellType)GridObject.ActiveSheet.Cells[Row, Col].CellType;
      cellType.MaxLength = 2000;
   }
}


This above will change the Contents MaxLength to 2000 characters for all custom fields defined in the plugin.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Custom Field Sizes

Postby SBarnes » Wed Aug 11, 2021 7:06 pm

And now I am confused we had a client get a truncation error from SQL in the inventory import screen, I've seen the screenshot they sent me and they told me they were importing custom fields.

I think I am going to need to get the input spreadsheet from them and se what I can figure out.

Thanks for the code to increase what the grid will take.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Custom Field Sizes

Postby SBarnes » Thu Aug 12, 2021 3:20 pm

Ok mystery solved so after I got the import data from the customer the problem was actually the details field(Aux3), the only problem with the error about truncation they go it they couldn't tell which field was causing it.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Custom Field Sizes

Postby Mike.Sheen » Thu Aug 12, 2021 5:43 pm

SBarnes wrote:Ok mystery solved so after I got the import data from the customer the problem was actually the details field(Aux3), the only problem with the error about truncation they go it they couldn't tell which field was causing it.


Ah.

We make our support dept. verify the claims a customer makes before handing it off to us for this very reason.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Custom Field Sizes

Postby SBarnes » Thu Aug 12, 2021 5:52 pm

Support department what's that? :lol:

Last time I checked I thought I had a sign around my neck that said everybody with a strange and stupid problem please drop it at my feet with no details and I'll solve it :shock:
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Custom Field Sizes

Postby pricerc » Thu Aug 12, 2021 6:02 pm

SBarnes wrote:Ok mystery solved so after I got the import data from the customer the problem was actually the details field(Aux3), the only problem with the error about truncation they go it they couldn't tell which field was causing it.


It was only a very recent version of SQL that finally started providing that information.

Microsoft have some of the laziest error messages.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: Custom Field Sizes

Postby SBarnes » Thu Aug 12, 2021 6:07 pm

Now now, if we are going to start bashing the big corporates can we please NOT just limit it to Microsoft. :D
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Custom Field Sizes

Postby SBarnes » Mon Sep 13, 2021 10:56 am

Can I increase the size of Aux3/ Details in inventory to max size without any major issues, and if I can what might need to be done in a plugin to set the length on the control itself.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: Custom Field Sizes

Postby Mike.Sheen » Mon Sep 13, 2021 6:03 pm

SBarnes wrote:Can I increase the size of Aux3/ Details in inventory to max size without any major issues, and if I can what might need to be done in a plugin to set the length on the control itself.


You just need to set the MaxLength of the DetailsTextBox on the form. The business logic doesn't trim anything on read or write, and neither does the form.

Code: Select all
InventoryForm.DetailsTextBox.MaxLength = 250;


Keep in mind if you change it to VARCHAR(MAX) you won't be able to index on that field - which may or may not be important to you, depending on how that field is going to be used. We currently don't have an index on it, but if you plan on doing any queries to find items by the contents that field, then perhaps consider VARCHAR(8000) or something.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests