DynamicQuery could not be found

Upgrading from 9.05.702A to 10.1.500.14. The code that works in E9 in Part Maintenance to populate an epiCombo does not work in E10.

I added the Custom Assembly Ice.Contracts.BO.DynamicQuery

Receiving the following errors:
Error: CS0246 - line 59 (473) - The type or namespace name ‘DynamicQuery’ could not be found (are you missing a using directive or an assembly reference?)
Error: CS0246 - line 59 (473) - The type or namespace name ‘DynamicQuery’ could not be found (are you missing a using directive or an assembly reference?)
Error: CS0246 - line 59 (473) - The type or namespace name ‘Session’ could not be found (are you missing a using directive or an assembly reference?)
Error: CS0246 - line 61 (475) - The type or namespace name ‘QueryDesignDataSet’ could not be found (are you missing a using directive or an assembly reference?)
Error: CS0246 - line 63 (477) - The type or namespace name ‘QueryExecutionDataSet’ could not be found (are you missing a using directive or an assembly reference?)

Here is my added code:
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.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 **

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

	this.cboRptCategory.ValueChanged += new System.EventHandler(this.cboRptCategory_ValueChanged);
	// End Wizard Added Custom Method Calls
}

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

	this.cboRptCategory.ValueChanged -= new System.EventHandler(this.cboRptCategory_ValueChanged);
	// End Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
}

private void cboRptCategory_ValueChanged(object sender, System.EventArgs args)
{
	// Get Business Object
	DynamicQuery bo = new DynamicQuery(((Session)oTrans.Session).ConnectionPool);
	// Get BAQ
	QueryDesignDataSet ds = bo.GetByID("BECK-CategoryToSubCategory");
	// Put Category parameter into BAQ
	QueryExecutionDataSet execDS = bo.GetQueryExecutionParameters(ds);
	EpiCombo cb = (EpiCombo)sender;
	execDS.ExecutionParameter.AddExecutionParameterRow("Category", cb.Text, "character", false, "", "", null);
	int topNRecords = 0;
	bool hasMoreRows;
	DataSet results = bo.ExecuteParametrized(ds, execDS, "", topNRecords, out hasMoreRows);

The way that business objects are called form 9 to 10 changed drastically you should change your code to use Adapters to ensure they upgrade smoothly next time. There are several posts in this forum about it, here is a video I made a while back

3 Likes

Hello Jose,

Excellent video. I think I am 90% of the way there. I am populating an epiCombo with user codes based on the ValueChanged event from another epiCombo. Here is what I have come up with based on the code from Jose’s video:

The second epiCombo is populating with the correct list from the BAQ. One issue is that it is showing every column in the BAQ and I only want to show the CodeDesc column.Here are the epiCombo properties:

The other issue is when I choose something from the list I get the following error:

Thanks for the help.

Wait are you using UserCodes? if you are using User Codes you should be able to do this without writing any actual code.
Are you trying to drive values in Combo1 from selected Values in Combo2?

Correct(ish). Combo1 is a straight populate from UserCodes (CodeType Category). Works great.

Combo2 populates from a BAQ that is based on UD02 and UserCodes. UD02 maps different UserCodes together by Category and SubCategory.

After choosing a category from Combo1 the Combo2 list populates with all of the codes from the subcategory tied to that category.

Hopefully that makes sense.

If you use a BAQ Combo you can use BAQMarkUp to filter based on the value of another Bound Field in the same DataView…
for Example

Combo1 is bound to field MyDataView.Field1 (IE: Part.Character01)

And you want to filter Combo2 based on that value you can write the BAQ and add a filter on the field you’d like to filter using BAQ Markup such that the criteria is

Where myField = [EpiBinding: Part.Character01]

Then when the BAQCombo runs it will filter your field based on the selected value ofthe bound dataview

Let me know if that doesn’t make sense.

By BAQ Markup are you referring to adding Where myField = [EpiBinding: Part.ShortChar07] as a criteria in the BAQ? Part.ShortChar07 is the field that Combo1 is bound to.

I removed Combo2 and added a BAQ Combo.

[cid:image002.png@01D2AEE7.B7FA2C70]

That does not work. If I substitute in the BAQ Where myField = grp11 for Where myField = [EpiBinding: Part.ShortChar07] then it works for the grp11 code. So what am I missing with the EpiBinding?

Bill

The criteria should be set in the BAQ is that where you are setting it?

Yes. When I set it like this the BAQ Combo does not populate.

Got it! I had a space in the BAQ criteria after EpiBinding:

Thanks for all the help.

Bill

1 Like