Page 1 of 1

Custom Inventory Search in Bill of Materials

PostPosted: Fri Jul 06, 2018 1:35 pm
by JimmySu1402
All standard search does not have long enough description field.
I have created a custom search with Description length = 50

However, it does not seem to work with an error returned.

Your help will be much appreciated.

Re: Custom Inventory Search in Bill of Materials

PostPosted: Fri Jul 06, 2018 11:40 pm
by Mike.Sheen
Moved from version 6 forum to version 7 forum.

Re: Custom Inventory Search in Bill of Materials

PostPosted: Mon Jul 30, 2018 5:52 pm
by JimmySu1402
Hi Mike,

Would might test my plugin and let me know why i ran into issue when I am trying to use the custom search to add item to Bill of Material.

Re: Custom Inventory Search in Bill of Materials  Topic is solved

PostPosted: Mon Jul 30, 2018 8:03 pm
by Mike.Sheen
JimmySu1402 wrote:Hi Mike,

Would might test my plugin and let me know why i ran into issue when I am trying to use the custom search to add item to Bill of Material.


Hi Jimmy,

This is caused by that search wanting a column returned including the quantity decimal places for the item - it's a multi-select search allowing you to key in the quantity of each item selected - and in order to format that cell properly it needs to know a column to use for that.
ASAS Custom Search.PNG


Another search query has already defined column 10 as containing the quantity decimals, so you just need to return a column with index 10 containing a value.

Your fix is to change your Search_Showing method to be as follows:

Code: Select all
Private Sub Search_Showing(sender As Object, e As System.EventArgs)
Dim search As JiwaApplication.JiwaSearch.clsSearch = sender
With search
   If .CurrentSearchMode = JiwaApplication.JiwaSearch.clsSearch.SearchModes.jswInventory Then
      
      ' Add Inventory Custom Search to display
      Dim AOption As New JiwaApplication.JiwaSearch.SearchOption
         With AOption
         .Title = "ASAS - CustomSearch"
         .SQLStr = "SELECT IN_Main.InventoryID, IN_Main.PartNo, IN_Main.Description, CASE IN_Main.Status WHEN 0 THEN '0. Normal' WHEN 1 THEN '1. Discontinued' WHEN 2 THEN '2. Deleted' WHEN 3 THEN 'Slow Moving' WHEN 4 THEN '4. Obsoleted' END AS ItemStatus, IN_Main.DecimalPlaces " +
                  "FROM IN_Main "

         .OrderBy = "ORDER BY PartNo"
         .AddColumn("InventoryID", vbString, "", 0, 1)
         .AddColumn("Part No", vbstring, "", 15, 2)
         .AddColumn("Item Description", vbString, "", 50, 3)
         .AddColumn("Item Status", vbstring, "", 9, 4)
         .AddColumn("Decimals", VariantType.Integer, "", 0, 10)         
      End With
         
      .Options.Add(AOption)                     
   End If
End With
End Sub


Mike