Creating a Part Search for BAQ

Yes, with a recursive query, you will actually need the parameter or it’s going to do what you are witnessing. A where clause only gets you so far.

The only way that they have it set up right now to pass a parameter into a dashboard without a popup is a publish and subscribe. Where you have a feeder grid publishing the value for the parameter, and then a “filter” (not tracker, filter in the properties) on the grid that needs the parameter.

I see that now, as no matter what I seem to do it still times out when I remove my parameter.

Would you be able to give me some information on how to set that up? I’m mostly a newb when it comes to stuff like this.

You hit the magic combo where you need it ! :cry:

Sounds about right with my luck. This whole project has been a fun experience lol :lying_face:

We should be able to use the same approach then, just one level up.
Have the filter populate a matching grid of parts, then publish that partnum for the lower grid to consume.

So on your feeder query, you make a list of what you will need for the parameters. Then use properties, and check on the field that you want to publish.

On the receiver query, go the the parameters tab, and select the parameter, and make it equal to the field that you published.

Here you can see that it changes and you change rows.
parameterrefresh

So this isn’t ideal, as the query probably takes a little bit in your case, and it will refresh everytime you click on a different row, but it gets rid of the popup. I’m not really sure which is better.

When you’re new, it’s all about a lack of knowledge. I still feel new.

It shouldn’t be too hard to combine @aarong’s & @Banderson’s approach together.
It won’t be too hard to adapt

Yea, I don’t think this will work, as it takes out all my functionality in searching for multiple parts, and the refresh would be highly annoying.

I think that’ll work nicely. He just needs to use the partsearch bit to filter a simple query of parts, and
then feed the lower query.

Maybe I need to start looking at the lesser of two evils here…

Have you ever read into this at all? Would it be possible to use this in a grid within my dashboard, and just use my text box as the paramaters it calls?

Also, I’m not sure if we have different versions but mine doesnt look like that in dashboard?

Ah, damn. I didn’t take the time to look at your version. Yeah, that’s a newer improvement.

Ok so I think I might take this in a different direction here.
If I create a BPM Form, can I call out the BAQ and return a table?

I have this so far, which I think works?

// **************************************************
// Custom code for IP_IndentedBOM
// Created: 1/17/2023 10:04:29 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **
	DynamicQueryAdapter dynamicQueryAdapter;

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls
		dynamicQueryAdapter = new DynamicQueryAdapter(IP_IndentedBOM);
		dynamicQueryAdapter.BOConnect();
	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal
		dynamicQueryAdapter.Dispose();
		// End Custom Code Disposal
	}
    private void IP_IndentedBOM_Load(object sender, EventArgs args)
    {
        string myPartNum = "QS-REF-02AP2";
        QueryExecutionDataSet queryExecutionDataSet = new QueryExecutionDataSet();
        queryExecutionDataSet.Tables["ExecutionParameter"].Rows.Add("PartNum", myPartNum, "nvarchar", false, null, "A");
        dynamicQueryAdapter.ExecuteByID("IndentBOM", queryExecutionDataSet);
    }
}

I just need a way to return the results in a table view. The guide I’m following doesn’t really explain how to do that, just gives me the overall “result”.

dynamicQueryAdapter.QueryResults.Tables["Results"]

From there I’m assuming I can just use a textbox as the string that gets sent along with the BAQ?

You mean like this?

There are SO many directions you can take to accomplish this.

Yea I would assume so. I just thought a dashboard would be the easiest. I guessed wrong lol. Epicor makes everything so difficult!

Have you tried using “like” in your filtering when you put in the parameter? You can make an expression that adds in the wildcards that you need.

For parameters it simply does Part_MtlPart MATCHES @PartNum paramater

I was able to get this working now with a BPM Form. Thanks for all of your guys help with this. Hopefully in the future I will get to use all this new knowledge!

I wish I could mark all of your answers as a solution! As my original question was only about the Part Search portion, I’ll mark the code to get a button with a quicksearch working as the solution. But you all have been a great help!

1 Like

There’s something in here for everyone! :tada: