Inventory Custom Search  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Inventory Custom Search

Postby 2can2 » Wed Apr 12, 2017 6:29 pm

Hi, I have created a custom plugin for an Inventory search but keep getting an error 'Argument length must be equal or greater than zero' - I can't see anything wrong with the code and I have similar variations running on different sites. Can you tell me where my code is wrong? Custom code below and plugin attached.
Private Sub Search_Showing(sender As Object, e As System.EventArgs)
With JiwaApplication.Manager.Instance.Search
If .CurrentSearchMode = JiwaApplication.JiwaSearch.clsSearch.SearchModes.jswInventory Then

' Inv Desc Search widen desc, partno columns DH 120417
Dim AOption As New JiwaApplication.JiwaSearch.SearchOption
With AOption
.Title = "*RR Desc."
.SQLStr = "SELECT IN_Main.InventoryID, IN_Main.Description, IN_Main.PartNo, " & _
"Cat1.Description, Cat2.Description, Cat3.Description, IN_Classification.Description, IN_Main.DefaultPrice " & _
"FROM IN_Main INNER JOIN IN_Category1 AS Cat1 ON (IN_Main.Catagory1ID = Cat1.Category1ID) " & _
"Inner JOIN IN_Category2 AS Cat2 ON (IN_Main.Catagory2ID = Cat2.Category2ID) " & _
"Inner JOIN IN_Category3 AS Cat3 ON (IN_Main.Catagory3ID = Cat3.Category3ID) " & _
"Inner JOIN IN_Classification ON (IN_Main.ClassificationID = IN_Classification.InventoryClassificationID) " & _
"WHERE IN_Main.Status <> 2 "
.OrderBy = "ORDER BY IN_Main.Description "

.AddColumn("InventoryID", vbString, "", 0, 1)
.AddColumn("Description", vbString, "", 36, 2)
.AddColumn("PartNo", vbString, "", 15, 3)
.AddColumn("Cat L1", vbString, "", 10, 4)
.AddColumn("Cat L2", vbString, "", 10, 5)
.AddColumn("Cat L3", vbString, "", 10, 6)
.AddColumn("Classification", vbString, "", 10, 7)
.AddColumn("Price", vbDecimal, "", 6, 8)
.AddColumn("DecimalPlaces", vbString, "", 0, 9)
End With

.Options.Add(AOption)
End If
End With
End Sub
Attachments
Plugin RR Custom Sk Search.xml
(30.83 KiB) Downloaded 142 times
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25

Re: Inventory Custom Search  Topic is solved

Postby 2can2 » Wed Apr 12, 2017 8:44 pm

Hi, I found a previous post where you added a sample plugin for the Inventory search. The syntax in the sample added an L to the VBString which has solved my issue.

The code that had an error was - .AddColumn("Description", vbString, "", 36, 2) and I updated it to - .AddColumn("Description", vbString, "L", 36, 2)
What threw me is I have another custom search running on the same DB using the original syntax with NO issue? I don't understand why?

The other query is if I use the sample for decimal it Left justifies - .AddColumn("Price", vbDouble, "#.00;\ ;\ ", 6, 8)
Yet if I leave my original code it Right justifies and works fine - .AddColumn("Price", vbDecimal, "", 6, 8)
What is the correct syntax to use and if the first how do I get it to Left justify?
Thanks
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 17 guests