Increasing the editable length of a custom field  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Increasing the editable length of a custom field

Postby indikad » Thu Feb 02, 2017 4:07 pm

Jiwa 7.0.175

The default field length on a custom field on ( Inventory master for example) is 255.

We have a customer on 6.5.13 that has increased the underlying table column data size and also uses a breakout code to accommodate typing in large number of characters.

the existing 6.5.13 code is below. Can you please let me know a way of achieving this in 7.0.175 ?
simply increasing the field size on the db side will not help according to this post below
viewtopic.php?f=14&t=257&p=756&hilit=custom+field+length#p756

6.5.13 code
Code: Select all
UPDATE IN_CustomSetting SET ScriptFormatCell = '
GridObject.Col = Col
GridObject.Col2 = Col
GridObject.Row = Row
GridObject.Row2 = Row
GridObject.TypeMaxEditLen = 32000
End Sub
' WHERE CellType = 1
GO

indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Increasing the editable length of a custom field  Topic is solved

Postby Mike.Sheen » Thu Feb 02, 2017 5:36 pm

Use the FormatCell method in the CustomFieldPlugin class:

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 (CustomField.PluginCustomField.Name == "TestField")
   {
      var cellType = (FarPoint.Win.Spread.CellType.TextCellType)GridObject.ActiveSheet.Cells[Row, Col].CellType;
      cellType.MaxLength = 2000;
   }
}


Sample attached.
Attachments
Plugin Inventory Custom Field Length.xml
Sample Plugin
(31.17 KiB) Downloaded 160 times
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Increasing the editable length of a custom field

Postby indikad » Thu Feb 02, 2017 9:36 pm

Great - thanks for the quick reply. Will try.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Increasing the editable length of a custom field

Postby indikad » Fri Feb 03, 2017 5:29 pm

I could be doing something wrong.
I used your code ( could not compile your plugin since I am on version 157 and think your would be version/s higher. )
however I used the code highlighted on the forum post but no response.
The underlying "contents" field in in_customsettingvalues takes varchar(-1) - max - anyway

yet the field beeps when I type a string larger than 255 characters.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Increasing the editable length of a custom field

Postby Mike.Sheen » Fri Feb 03, 2017 6:27 pm

Did you change the field name in this line:

Code: Select all
if (CustomField.PluginCustomField.Name == "TestField")


to match yours?
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Increasing the editable length of a custom field

Postby indikad » Fri Feb 03, 2017 8:04 pm

Yup! sure did. Took it from the SettingName of IN_CustomSetting
it obviously is working for you ! what version are you on?
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Increasing the editable length of a custom field

Postby Mike.Sheen » Sat Feb 04, 2017 11:20 am

indikad wrote:Yup! sure did. Took it from the SettingName of IN_CustomSetting
it obviously is working for you ! what version are you on?


You're going to have to post a plugin demonstrating the issue - I suggest you copy your plugin, remove any irrelevant parts and post it here.

Note that if your custom field is not defined in your plugin, but a different plugin then that could explain the problem - the FormatCell method of the CustomFieldPlugin won't be called for settings in other plugins, just the current one.
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Increasing the editable length of a custom field

Postby indikad » Mon Feb 06, 2017 10:03 am

Note that if your custom field is not defined in your plugin, but a different plugin then that could explain the problem - the FormatCell method of the CustomFieldPlugin won't be called for settings in other plugins, just the current one.


That was it! I had the code in a separate plugin. Moved it to the same plugin that the custom field is on and it works. Thanks.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Increasing the editable length of a custom field

Postby Ernst » Fri Jul 14, 2017 10:11 am

Hiya Mike,

WHat would the VB version of

if (CustomField.PluginCustomField.Name == "TestField")
{
var cellType = (FarPoint.Win.Spread.CellType.TextCellType)GridObject.ActiveSheet.Cells[Row, Col].CellType;
cellType.MaxLength = 2000;
}

Look like. Thanks
User avatar
Ernst
Kohai
Kohai
 
Posts: 221
Joined: Tue Feb 19, 2008 3:43 pm
Topics Solved: 12

Re: Increasing the editable length of a custom field

Postby Mike.Sheen » Fri Jul 14, 2017 8:49 pm

Ernst wrote:Hiya Mike,

WHat would the VB version of

if (CustomField.PluginCustomField.Name == "TestField")
{
var cellType = (FarPoint.Win.Spread.CellType.TextCellType)GridObject.ActiveSheet.Cells[Row, Col].CellType;
cellType.MaxLength = 2000;
}

Look like. Thanks


There are really useful and free to use online tools like the Telerik Code Converter which will do this for you.

Putting the above in there and choosing "C# to VB" yields the following:
Code: Select all
If CustomField.PluginCustomField.Name = "TestField" Then
   Dim cellType = DirectCast(GridObject.ActiveSheet.Cells(Row, Col).CellType, FarPoint.Win.Spread.CellType.TextCellType)
   cellType.MaxLength = 2000
End If
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: Bing [Bot], DannyC and 1 guest