Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E10 Adding a UD field to an EpiUltraGrid

Status
Not open for further replies.

LukeBev

Technical User
Apr 15, 2015
1
0
0
GB
I am trying to customize a EpiUltraGrid that we have on the order entry screen.
I am trying to add a new column with a database value which would read from a field called SalesDescription_c which is in the parts table as an extended ud field.

I have managed to add the column in and set a static value via
Code:
e.Row.Cells.Value = "String Here";
But now i want this to be dynamic and all of my efforts so far have failed.

The custom code from the script editor can be seen below:
I have tried various options found via Google and commented them out in the code.

Code:
// **************************************************
// Custom code for SalesOrderForm
// Created: 16/01/2015 16:33:34
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;
using Erp.Adapters;
 
public class Script
{
    // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
    // Begin Wizard Added Module Level Variables **
    private EpiBaseAdapter oTrans_partAdapter;
    // End Wizard Added Module Level Variables **
    // Add Custom Module Level Variables Here **
    Ice.Lib.Framework.EpiUltraGrid myGrid;
 
    public void InitializeCustomCode()
    {
        // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
        // Begin Wizard Added Variable Initialization
        this.oTrans_partAdapter = ((EpiBaseAdapter)(this.csm.TransAdaptersHT\\["oTrans_partAdapter"\\]));
        // End Wizard Added Variable Initialization
        // Begin Wizard Added Custom Method Calls
        SetExtendedProperties();
        // End Wizard Added Custom Method Calls
 
        myGrid = (Ice.Lib.Framework.EpiUltraGrid)csm.GetNativeControlReference("bec51417-b286-4d61-a471-3912bc098905");
        myGrid.DisplayLayout.Bands\\[0\\].Columns.Add("SalesDescription_c","Sales Description");
        myGrid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grdMatLst_InitializeRow);
    }
 
private void grdMatLst_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
EpiDataView salesDesc = (EpiDataView)(this.oTrans.EpiDataViews\\["Stock"\\]);
//PartAdapter myOrderAdapt = new PartAdapter(this.oTrans); 
//myOrderAdapt.BOConnect();
//salesDesc.dataView.Table.Rows\\["PartNum"\\];
 
foreach(DataRowView drV in salesDesc.dataView.Table.Rows) 
{ 
object sValue = drV\\["SalesDescription_c"\\];
//int pNum = salesDesc.dataView.Table.Rows\\[0\\]; 
e.Row.Cells\\["SalesDescription_c"\\].Value = sValue.ToString();
}
 
//e.Row.Cells\\["SalesDescription_c"\\].Value = salesDesc.dataView.Table.Rows\\["SalesDescription_c"\\];
 
//e.Row.Cells\\["SalesDescription_c"\\].Value = "pNum";
 
}
 
    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
 
        // End Custom Code Disposal
    }
 
    private void SetExtendedProperties()
    {
        // Begin Wizard Added EpiDataView Initialization
        EpiDataView edvOrderDtl = ((EpiDataView)(this.oTrans.EpiDataViews\\["OrderDtl"\\]));
        // End Wizard Added EpiDataView Initialization
 
        // Begin Wizard Added Conditional Block
        if (edvOrderDtl.dataView.Table.Columns.Contains("PartNum"))
        {
            // Begin Wizard Added ExtendedProperty Settings: edvOrderDtl-PartNum
            edvOrderDtl.dataView.Table.Columns\\["PartNum"\\].ExtendedProperties\\["ZoneBAQ"\\] = "CustomSalesEntrySearch";
            edvOrderDtl.dataView.Table.Columns\\["PartNum"\\].ExtendedProperties\\["ZoneSearchOnEmptyControl"\\] = true;
 
            // End Wizard Added ExtendedProperty Settings: edvOrderDtl-PartNum
        }
        // End Wizard Added Conditional Block
    }
 
 
}
I am desperate to get this sorted ASAP, i'm rather new to C# in general so if you need any more information please let me know.
 
You can create a BAQ for the part table and then create a BAQ combo box that will review the in the customization. When you get to the properties of the BAQ Combo you will fill in the following:

DisplayMember - Tablename.field
DynamicQueryID - BAQ Name
ValueMember - TableName.Field

Then go to the EpiBinding and bind the BAQ Combo to your field in the Table you are on.

Hope this helps.

Thanks,
Fiducia-us
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top