Inventory Category Custom Field Lookup

Discussions relating to plugin development, and the Jiwa API.

Inventory Category Custom Field Lookup

Postby SBarnes » Mon May 25, 2020 7:01 pm

I am trying to add a lookup custom field to inventory Categories 2 and 3 but can not get the button click event to fire.

I have already done the following:

1. Under form references added Inventory Categories
2. Under business login references added the following
Inventory Categories
Inventory Category Configuration 1
Inventory Category Configuration 2
Inventory Category Configuration 3

what am I doing wrong as in the button click I can't even get a message box to show, let alone the search window?

This is in 7.2.1

There is also a bug where on the custom field if you hit the look up button on the custom field on last row where no data is entered you get a null reference exception.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Inventory Category Custom Field Lookup

Postby SBarnes » Tue May 26, 2020 11:02 am

OK so I've worked out the issue here in Jiwa for inventory categories, they are custom line fields not custom fields
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Inventory Category Custom Field Lookup

Postby Scott.Pearce » Tue May 26, 2020 11:46 am

I suspected as much.

I've attached a plugin which also locks the last row lookup button. I had to jump through some hoops to achieve this. I'll log a bug to have the native code corrected and will post the bug no. back here.

Plugin Add lookup to Inventory Category 2.xml
(35.65 KiB) Downloaded 44 times
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Inventory Category Custom Field Lookup

Postby SBarnes » Tue May 26, 2020 11:49 am

Thanks Scott
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Inventory Category Custom Field Lookup

Postby Scott.Pearce » Tue May 26, 2020 11:52 am

Also logged as DEV-8248
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Inventory Category Custom Field Lookup

Postby SBarnes » Tue May 26, 2020 3:34 pm

Hi Scott

I've largely gotten setting the values to work with 1 minor glitch when the search window comes down the grid display value is not updating, I know the correct value is going in because if you hit save it appears and I've checked with VS, below is the code any idea on how to get around this issue

Code: Select all
            if (search.Results.Count > 0)
            {                  
               var idField = (JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.Field)search.get_Fields(1);
               CustomFieldValue.Contents = idField.FieldValue.ToString();
               
               var DescriptionField = (JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.Field)search.get_Fields(2);
               
               CustomFieldValue.DisplayContents =  DescriptionField.FieldValue.ToString();
               GridObject.set_GridText(Col, Row,CustomFieldValue.DisplayContents);
               GridObject.Refresh();
            }
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Inventory Category Custom Field Lookup

Postby SBarnes » Tue May 26, 2020 3:39 pm

My Bad take 1 off the column value and it works
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Inventory Category Custom Field Lookup

Postby Scott.Pearce » Tue May 26, 2020 3:58 pm

Push the display data into .DisplayContents, and push the id value into .Contents. In the ReadData() function, you place code that resolves .Contents to .DisplayContents (ie. an ID to a Description). I've updated the plugin to show this.

Plugin Add lookup to Inventory Category 2.xml
(36.46 KiB) Downloaded 47 times


Edit: Setting .Contents will cause the appropriate row to re-display for you, so set .DisplayContents, THEN set .Contents. Do NOT set grid text directly, and get rid of the GridObject.Refresh line.

Edit 2:

Code: Select all
    if (search.Results.Count > 0)
            {     
               var DescriptionField = (JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.Field)search.get_Fields(2);
               CustomFieldValue.DisplayContents =  DescriptionField.FieldValue.ToString();
           
               var idField = (JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.Field)search.get_Fields(1);
               CustomFieldValue.Contents = idField.FieldValue.ToString();
            }
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Inventory Category Custom Field Lookup

Postby SBarnes » Tue May 26, 2020 4:02 pm

Hi Scott

I have read code and that works fine as proven by the screen saving and refreshing or going out of the screen and coming back in, for some reason without setting the grid cell explicitly is not refreshing but only when closing the search screen.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1617
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Inventory Category Custom Field Lookup

Postby Scott.Pearce » Tue May 26, 2020 4:04 pm

Yeah, it looks like setting .DisplayContents does not fire a change event, but setting .Contents does. So I set .Contents last.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron