Page 1 of 1

Custom field lookup to locate items on a specific sales orde

PostPosted: Thu Dec 24, 2015 12:12 pm
by DannyC
Hi,

My question is both Jiwa-specific and also a VB.Net programming issue.

I am using the Service Manager module as kind of big Customer Satisfaction Analysis Incidents module, so I need to locate an invoice no, and the items just on that invoice. The client will be using it to handle a fairly complex returns process.
I can easily create a custom field to lookup sales orders.

I have another custom field which will also be a lookup to select an item on the selected sales order from the above custom field.
I figured I could use the jswInventory as a lookup which is easy enough but how could I restrict it to just display the items on the sales order?

I tried creating a List (see attached) but I can't work out how to change the jswInventory search filter to just get the items contained in myList. I doubt it is the best way to approach this so would welcome your feedback.

And have a great Christmas guys. Really appreciate your help this year.

Re: Custom field lookup to locate items on a specific sales   Topic is solved

PostPosted: Mon Jan 18, 2016 11:47 am
by Mike.Sheen
DannyC wrote:I figured I could use the jswInventory as a lookup which is easy enough but how could I restrict it to just display the items on the sales order?


You were on the right track by using a where clause for the item being in a given set - I think you got stuck here:

Code: Select all
existingSearchOption.SQLStr += " IN_Main.InventoryID IN (" & myItems & ")"


As myItems is a list, you'll need to iterate and build the string like so:

Code: Select all
If myItems.Count > 0 Then            
   Dim filterItems As String = ""

   For Each item As String In myitems
      If filterItems.Trim.Length > 0 Then
         filterItems += ", "
      End If
      
      filterItems += "'" + item + "'"
   Next

   existingSearchOption.SQLStr += " IN_Main.InventoryID IN (" + filterItems + ")"
End If

Re: Custom field lookup to locate items on a specific sales

PostPosted: Mon Jan 18, 2016 3:53 pm
by DannyC
Awesome Mike.
That has done it.

The attached plugin was a bit faulty, but once I sussed it out it works just great!

Cheers

Danny