Bug in Logical Printer Search Code

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Bug in Logical Printer Search Code

Postby SBarnes » Wed Sep 23, 2026 6:14 pm

I think there is a possible bug in the search mode for logical printers as the following code produces an error about invalid object name SY_LogicalPrinters which is not a table in the database.



Code: Select all
public void ButtonClicked(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic BusinessLogicHost, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm FormObject, int Col, int Row, JiwaFinancials.Jiwa.JiwaApplication.IJiwaCustomFieldValues HostObject, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
    {
      if(CustomField.PluginCustomField.Name == "SalesOrderPrinter" || CustomField.PluginCustomField.Name == "DeliveryDocketPrinter")
      {
         System.Diagnostics.Debugger.Launch();
         System.Diagnostics.Debugger.Break();
         var search = BusinessLogicHost.Manager.Search;

         //JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.clsSearch.SearchModes searchMode = JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.clsSearch.SearchModes.jswArchivingJobs;

         search.Clear();
         JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.clsSearch.SearchModes searchMode = JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.clsSearch.SearchModes.jswLogicalPrinters;
         search.SetDefaultSearch(ref searchMode);
         search.UsePinBoard = false;


         if (search.Show((System.Windows.Forms.Form)BusinessLogicHost.Client) == DialogResult.OK)
         {
            //System.Diagnostics.Debugger.Launch();
            if (search.Results.Count > 0)
            {
               var idField = (JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.Field)search.get_Fields(1);

               CustomFieldValue.Contents =  idField.FieldValue.ToString();
               JiwaFinancials.Jiwa.JiwaApplication.PrintGroup.Maintenance.LogicalPrinterCollection logicalPrinters = BusinessLogicHost.Manager.CollectionFactory.CreateCollection<JiwaFinancials.Jiwa.JiwaApplication.PrintGroup.Maintenance.LogicalPrinterCollection, JiwaFinancials.Jiwa.JiwaApplication.PrintGroup.Maintenance.LogicalPrinter>();
                   logicalPrinters.Read();
               CustomFieldValue.DisplayContents = logicalPrinters[CustomFieldValue.Contents].Name;
            }
         }         
      }
      
    }


The sql produced is

Code: Select all
SELECT SY_LogicalPrinters.RecID, SY_LogicalPrinters.Name, SY_LogicalPrinters.PhysicalPrinterName FROM SY_LogicalPrinters
ORDER BY SY_LogicalPrinters.Name

Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1717
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 193

Re: Bug in Logical Printer Search Code

Postby Mike.Sheen » Wed Sep 23, 2026 6:24 pm

Thanks - logged as DEV-13085.

We never have a need to search for a logical printer, so we've not bumped into this. We'll be nice and make it work, rather than remove it.
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: 2632
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 827

Re: Bug in Logical Printer Search Code

Postby SBarnes » Wed Sep 23, 2026 6:30 pm

:lol: I'll be nice and post the code for doing the search as a raw SQL to make it work in case anyone needs it in the meantime but that's a job for the morning
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1717
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 193


Return to Technical and or Programming

Who is online

Users browsing this forum: Bing [Bot] and 332 guests