Quick search, nothing in list?


(Brandon Anderson) #1

So I want to make a quick search, but I don’t want it to be default, just available. I tried to get it to work in 10.1.600 and it didn’t, I then tried in 10.2.200 thinking it was a bug they may have fixed. Still doesn’t work. It will show up if I click base default, but I don’t want it to be base default. Any way to make it show up in the normal list?


(Haso Keric) #2

If you right click on the CustID field can you access it via an Open With…

Perhaps the Customer Screen Secretly on the Button Press considers CustNum to be its Context Field and not CustID and when doing Base Default, it will show up no matter what.

If I recall the Quote always only had CustNum and you always needed to Join to Customer to get the CustID. The Quote’s button press may be invoking a search behind the scenes different that the input field.


(Brandon Anderson) #3

I didn’t know that! That will probably work. Thanks!


(Haso Keric) #4

You could always Move the button away… place a new button in its place, same width, same height, same label and then handle the QuickSearch yourself =)

Example:

	public bool InvokeGetInvoicesSearch()
	{

		object ret = ProcessCaller.InvokeAdapterMethod(oTrans.EpiBaseForm, "QuickSearchAdapter", "ShowQuickSearchForm", new object[] { oTrans.EpiBaseForm, "SMI-ARInvoiceReadyForMSO", true /* multi-select */, new DataTable() });

		// user cancelled
		if (ret == null) {
			return false;
		}

		//ArrayList resultObjects = ...;
		//List<string> results = resultObjects.Cast<string>().ToList();

		ArrayList selections = ret as ArrayList ?? new ArrayList { ret.ToString() };

		foreach (string row in selections)
		{

		 }

		return true;
	}

Then Just do a

		EpiDataView edvUD100A = this.oTrans.Factory("UD100A");

		foreach (string row in selections)
		{
			string invoiceNum = row;
			edvUD100A.dataView[edvUD100A.Row]["ChildKey3"] = row;
		 }

Also IF you do single select on top then ret would actually be your value, no need for looping and ArrayList.

Could be as simple as:

yourField = ProcessCaller.InvokeAdapterMethod(oTrans.EpiBaseForm, "QuickSearchAdapter", "ShowQuickSearchForm", new object[] { oTrans.EpiBaseForm, "SMI-ARInvoiceReadyForMSO", false /* multi-select */, new DataTable() });

// From Jose:
// If multi-select, ret is an ArrayList whose elements are the selected values
// If single-select, ret is the selected value – create an ArrayList and add it

For those wondering what happens if the QS is missing, the user will receive a exception dialog with “Quick Search is missing”.

@Chris_Conn does this like daily.


(Brandon Anderson) #5

I don’t want it changed all of the time, or I would use the base default check box. It’s only a couple of users who want it some of the time.

Interesting example though.

No mouse Chris…


(Haso Keric) #6

Rumor has it he has a fetish for replacing buttons with his own… In his TST Environment they all have been replaced only so he can give them a new object name with a prefix of ex: txtChris_CustNum. Not sure if its true or if @jgiese.wci is making stuff up :slight_smile:


(Chris Conn) #7

Bahaha. It may be true. It took me a while to figure out I could break all that form logic by simply removing the epiBinding :blush:

Brandon, how about a custom button just for those users? Like @hasokeric suggests, calling a quicksearch manually is probably the ticket.


(Haso Keric) #8

You could also maybe do something with the Context Handler Registering:

	oTrans.RegisterContextHandler("QuoteHed.CustNum", "Click this...", handleContextClick); 

	object handleContextClick(object sender, object currentValue) 
	{
		MessageBox.Show("Current value is: " + currentValue.ToString() + "; setting to 'foo'");
		return "foo";
	}