How do I populate data from OrdDtl in JobHead

I have a UD field in OrdDtl table I want to populate that data in a UD field on the job entry form if it is populated for the Order Num on the job.

I was trying to do this on the Job Entry screen but I can’t get it to work. What is the best way to do this?

I’ve tried just binding the OrdDtl ud field on the field in job entry and it doesn’t like that either.

In your if-statement, you need begin and end edits:

edvJobProd.dataView[edvJobProd.Row].BeginEdit();
edvJobProd.dataView[edvJobProd.Row]["Character03"] = ETO;
edvJobProd.dataView[edvJobProd.Row]["CheckBox03"] = true;
edvJobProd.dataView[edvJobProd.Row].EndEdit();

Thank you for the comment. I’ve added that to my code.
It is not getting the data from the orderdtl table so i can pull it into the jobhead table. Can I not call OrdDtil from the job entry form? If not, how can i get that data into the jobhead table/

Any help is much appreciated.

@tmayfield , are you MTO? if you are, the JobProd table contains the links to the SO that the job is for.

The data i want to pull into the JobProd table is from a UD field on the OrdDtl_UD table.

On sales order entry the salesperson can enter a number into a UD text field, that data needs to be shown on the matching job created from that sales order. So I am trying to pull that data from OrdDtl if the job matches the sales order and display it in a UD text field on the job.

You’ll need to call the adapter and pass in the order number.

	private void CallSalesOrderAdapterGetByIDMethod(int intId)
	{
		try
		{
			// Declare and Initialize EpiDataView Variables
			// Declare and create an instance of the Adapter.
			SalesOrderAdapter adapterSalesOrder = new SalesOrderAdapter(this.oTrans);
			adapterSalesOrder.BOConnect();

			// Declare and Initialize Variables
			// TODO: You may need to replace the default initialization with valid values as required for the BL method call.


			// Call Adapter method
			bool result = adapterSalesOrder.GetByID(intId);

			MessageBox.Show(adapterSalesOrder.SalesOrderData.OrderHed[0]["ShipViaCode"].ToString());

			// Cleanup Adapter Reference
			adapterSalesOrder.Dispose();

		} catch (System.Exception ex)
		{
			ExceptionBox.Show(ex);
		}
	}

Make sure to add the adapter/contract:

1 Like