ComboBoxCellTypes in Sample Plugin Editable List Maintenance  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

ComboBoxCellTypes in Sample Plugin Editable List Maintenance

Postby neil.interactit » Thu Apr 20, 2023 10:46 am

Hi Mike,

I am wondering if you could take a look at the attached code?

I have built up a form based on your Sample Plugin - Editable List Maintenance Form (viewtopic.php?f=27&t=498).

My form has a few extra columns with lookups using ComboBoxCellType. I am stuck with displaying retieved values in the ComboBoxCellType cells (selecting a value manually and saving works, just the retrieving doesn't).

I based the ComboBoxCellType code initially on JiwaFinancials.Jiwa.JiwaCashBookUI.frmCashBookReceipts and JiwaFinancials.Jiwa.JiwaCashBookUI.frmCashBook, and then to resolve this displaying issue included some extra code based on the JiwaFinancials.Jiwa.JiwaApplication.Notes.NoteGridController "Type" column.

I have been fighting this for a while now without success.

Would you mind taking a look? The attached should be self sufficient - Plugin / New / C# / paste the code / save / execute the SQL from the SQL Region.

(The ComboBoxCellTypes use RecID/Description as live data comes from other tables - I have hardcoded some data in the attached to remove dependency)

Many thanks,
Neil
Attachments
DeliveryRuns.cs.txt
(23.56 KiB) Downloaded 39 times
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: ComboBoxCellTypes in Sample Plugin Editable List Mainten

Postby Mike.Sheen » Thu Apr 20, 2023 11:33 am

Hi Neil,

If you export the plugin to XML, that'll make our lives easier as I can then just import it and I don't have to think about what references I might need or which forms / business logic I need to add.

Also if you add any SQL scripts as a document attachment, I can just right click the document after importing the plugin and open it to run the script without risking missing a bit or making some other mistake.

Also, when I do provide a fix I'll be able to give you a plugin back you just import, and if that fix included any new references or anything it'd just work - I couldn't do that If I gave you a text file of the code copy and pasted.
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: ComboBoxCellTypes in Sample Plugin Editable List Mainten

Postby neil.interactit » Thu Apr 20, 2023 12:38 pm

Thanks Mike, no probs at all. Attached.

BTW, this will need a menu item added to call it, per your instructions in the sample plugin.
Attachments
Plugin Delivery Runs No Dependency.xml
(50.22 KiB) Downloaded 39 times
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: ComboBoxCellTypes in Sample Plugin Editable List Mainten  Topic is solved

Postby Mike.Sheen » Sat Apr 22, 2023 1:28 pm

Not related to your issue, but the SQL script to create the form inserts a NULL into the Assembly name instead of the plugin RecID because the plugin is named "Delivery Runs No Dependency", but the script looks for a plugin named "HALS - Delivery Runs" :

Code: Select all
IF NOT EXISTS(SELECT TOP 1 * FROM SY_Forms WHERE ClassName = 'DeliveryRuns')
   INSERT INTO SY_Forms(ClassName, Description, FormType, HelpFileName, HelpPageName, AssemblyFullName)
   SELECT 'DeliveryRuns', 'Delivery Runs', 2, '', '',
   (SELECT TOP 1 RecID FROM SY_Plugin WHERE Name = 'HALS - Delivery Runs')
GO


I got past that and found the reason why your display of the combo box columns isn't working.

When you define the CellType for the combo box column, you are setting EditorValue = EditorValue.ItemData - this tells the grid that the underlying value is the ItemData, in your case the uniqueidentifier, and so when setting the cell Value you need to use the unqiueidentifier.

So, this works for setting the driver combo to be "Jimmy Jims":

Code: Select all
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "Driver").Index].Value = "DCA718A8-68BA-4F7A-B525-737A27AE4D92";


The grid will map the cell value "DCA718A8-68BA-4F7A-B525-737A27AE4D92" to the display value and display "Jimmy Jims" because you have it the list of Items (display values) and ItemData (underlying data value).

In your current structure you have mocked up some data, but I expect when you've fleshed this out some more your Driver property of the Delivery Run will be a complex type so you'll be able to do this:

Code: Select all
grdLines.ActiveSheet.Cells[Row, grdLines.ActiveSheet.GetColumnFromTag(null, "Driver").Index].Value = Item.Driver.RecID;
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: ComboBoxCellTypes in Sample Plugin Editable List Mainten

Postby neil.interactit » Mon Apr 24, 2023 2:43 pm

Perfect!

Thanks Mike.

Apologies for the SQL niggle - in my haste to knock up a "No Dependency" copy of the plugin I omitted to update that.

Thanks again,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: ComboBoxCellTypes in Sample Plugin Editable List Mainten

Postby Mike.Sheen » Mon Apr 24, 2023 3:08 pm

neil.interactit wrote:Apologies for the SQL niggle - in my haste to knock up a "No Dependency" copy of the plugin I omitted to update that.


No worries - one thing we're in the habit of doing lately is the very first line of the SQL script raises an error if the expected plugin does not exist - a lot of the time people import the plugin and run the script before saving the plugin, so the raise error alerts them to this, and also will bring to the surface any mis-match of expected plugin names.

Eg:

Code: Select all
IF NOT EXISTS(SELECT TOP 1 * FROM SY_Plugin WHERE Name = 'Promotional Incentives' AND Author = 'Jiwa Financials' )
   RAISERROR ('You must import and SAVE the plugin Promotional Incentives before running this script!', 20, 1) WITH LOG
GO

-- Rest of script goes in here - we won't get here if the above throws an error.
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: ComboBoxCellTypes in Sample Plugin Editable List Mainten

Postby neil.interactit » Mon Apr 24, 2023 5:17 pm

Makes good sense. I have updated SQL here to include. Thanks again.
neil.interactit
Kohai
Kohai
 
Posts: 227
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 29 guests

cron