Custom fields  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Custom fields

Postby DannyC » Fri Jul 04, 2014 2:19 am

Can you provide a demo plugin to demonstrate how to add custom fields to say, Sales Order Entry screen?

And for the combobox option, can you also give some demo code on how to provide an interface for the user to adjust the values?

Cheers

Danny
User avatar
DannyC
Senpai
Senpai
 
Posts: 638
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Custom fields

Postby Scott.Pearce » Fri Jul 04, 2014 1:07 pm

I've attached a plugin and a sql script (inside a .rar file).

Installation
-------------
1. Run the sql script
2. Import the plugin
3. Open "System Configuration->Forms", and add a new entry:
Type = Plugin
Assembly Full Name = "Sales Order Custom Fields with UI"
Class Name = "SalesOrderComboBoxConfiguration"
Description = "Sales Orders ComboBox Custom Field Configuration"
4. Open "System Configuration->Menu Configuration->Menu Maintenance", and add a new form entry to your menu:
Description = "Sales Orders ComboBox Custom Field Configuration"
5. Restart Jiwa.
6. To create some values for the combobox, load the configuration form "System Settings->Sales Orders ComboBox Custom Field Configuration", and enter some values.
7. Now load sales orders ("Sales->Order Entry"). On the "Custom" tab you should see a ComboBox custom field, and the ComboBox will allow selection of the values as defined in step 6. Note that if you change the possible ComboBox values on the configuration form, you will have to restart Jiwa before they appear in the ComboBox custom field.


Explanation
--------------
First, I created a custom table in the database called "SO_ComboBoxValues" to hold the values to be used in the ComboBox . Then I created a new plugin. On the plugin, I added the sales order custom field via the "Custom Fields" tab.

In the code section of the plugin, I created some business logic classes to read and write the combobox configuration values. These classes are "SalesOrderComboBoxValue" and "SalesOrderComboBoxValueCollection". They inherit from the Jiwa "ListMaintenance" classes - which means much of the work is already done for me in the base class.

Next, I created a form class called "SalesOrderComboBoxConfiguration", that actually inherits from the Jiwa "ListMaintenance.UserInterface" form. Once again, this means most of the work is done for me. I just had to handle a couple of events and define the grid columns.

Feel free to ask any questions you may have.
Attachments
Sales Order Custom Fields with UI.rar
(7.94 KiB) Downloaded 185 times
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Custom fields

Postby Mike.Sheen » Fri Jul 04, 2014 7:54 pm

Scott.Pearce wrote:Note that if you change the possible ComboBox values on the configuration form, you will have to restart Jiwa before they appear in the ComboBox custom field.


If that behaviour isn't desired - that is, if you want the current list of values to be used without restarting Jiwa, just replace these lines in the plugin:

Code: Select all
      Static comboBoxItemList As New List(Of String)
        Static comboBoxItemDataList As New List(Of String)


with:

Code: Select all
      Dim comboBoxItemList As New List(Of String)
        Dim comboBoxItemDataList As New List(Of String)


Scott was just being super efficient in his implementation and only reading the list of values if it had never been read before. The above change will allow the list to be re-read each and every time the host form (in this case sales orders) attempts to render the custom fields. If it's a small list, there won't be a significant performance impact reading the list every time a sales order is read or created.
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: Custom fields

Postby DannyC » Tue Aug 19, 2014 3:11 pm

Something isn't working.
When I open the sales order form I don't get any custom fields.
Is there supposed to be custom fields on the plugin? If so then I suspect the XML export for Plugins doesn't include the custom fields as I have nothing in custom fields on this plugin.
[EDIT:] I created my own custom field with CellType = combo in the plugin. Logged out & in. I now get the combobox on sales order custom fields tab, and values display from the entered list. That is awesome!

What is the association between the the plugin code and the tables XX_CustomSettng and XX_CustomSettingValues from 6.5.13?

Also the original question asked if we could have an example not just of a combo box but all types such as tickbox, string, integer, Jiwa lookup, decimal, etc.
Is this just a matter of a plugin with entries in the Custom Fields tab? If so, where does the data land? Still in the XX_CustomSettingValues tables?
Last edited by DannyC on Tue Aug 19, 2014 3:22 pm, edited 1 time in total.
User avatar
DannyC
Senpai
Senpai
 
Posts: 638
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Custom fields

Postby Mike.Sheen » Tue Aug 19, 2014 3:17 pm

DannyC wrote:Something isn't working.
When I open the sales order form I don't get any custom fields.
Is there supposed to be custom fields on the plugin? If so then I suspect the XML export for Plugins doesn't include the custom fields as I have nothing in custom fields on this plugin.

Also the original question asked if we could have an example not just of a combo box but all types such as tickbox, string, integer, Jiwa lookup, decimal, etc.

What is the association between the the plugin code and the tables XX_CustomSettng and XX_CustomSettingValues from 6.5.13?

I have got the dialog to enter values into the new table. That's awesome!


Bug 10886 relates to custom fields not being imported for plugins. It seems this problem was introduced by another recent change relating to importing plugins which have custom fields - which was introduced after Scott posted his reply, but before you had tested it.
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: Custom fields

Postby DannyC » Tue Aug 19, 2014 3:23 pm

Too quick Mike! I just edited my question above as you were answering. Found the solution for the combobox, but wondering about other custom fields too?

[EDIT:] Ok, after reviewing the SO_CustomSetting and SO_CustomSettingValues tables I now get the association. All sweet.
One further question re the combobox custom table. There are two columns Item and ItemData. It is only Item which displays in Jiwa when the combo is selected. In addition the SO_CustomSettingValues table stores the Item value, not ItemData value. Is that your intention? Seems to be no point in the ItemData column.

2nd question. How do I get old/existing custom fields to display in Jiwa? If I add them into a plugin with the identical names, I get an error "Cannot insert duplicate key row in object".
[EDIT:] Found answer. They're in the Legacy Pre-Version 7 Plugin. I am moving them one by one to another plugin so I don't need to enable the Legacy Pre-Version 7 Plugin as I doubt it would compile successfully.
User avatar
DannyC
Senpai
Senpai
 
Posts: 638
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Custom fields  Topic is solved

Postby Scott.Pearce » Tue Aug 19, 2014 5:37 pm

the SO_CustomSettingValues table stores the Item value

Logged as bug 10894

Also the original question asked if we could have an example not just of a combo box but all types such as tickbox, string, integer, Jiwa lookup, decimal, etc.
Is this just a matter of a plugin with entries in the Custom Fields tab?

Yes.

If so, where does the data land? Still in the XX_CustomSettingValues tables?

Yes.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Custom fields

Postby Atronics » Thu Oct 02, 2014 5:20 pm

Hi Scott,
I followed the installation step by step, was able to edit the values etc. However, there is nothing in the custom tab on the sales order. What am I missing?

John I.
Atronics
Frequent Contributor
Frequent Contributor
 
Posts: 119
Joined: Fri Feb 29, 2008 4:40 pm
Topics Solved: 10

Re: Custom fields

Postby DannyC » Thu Oct 16, 2014 5:36 pm

John,

The missing step might be to create the custom field in the plugin. See the Custom Fields tab.
User avatar
DannyC
Senpai
Senpai
 
Posts: 638
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Custom fields

Postby Scott.Pearce » Fri Oct 17, 2014 8:10 am

+1. Read Danny's post at:

http://forums.jiwa.com.au/viewtopic.php?f=26&t=205&p=678#p557

and see if that helps.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 9 guests