Capture Temporary Calculated Field

I have created custom fields on the QuoteQty table. How would I go about capturing the calculated fields on the Quote Worksheet tab of the Opportunity / Quote Tracker (or entry) forms?

I saw someone else mention capturing the quote cost fields in a custom field on an event but not sure how to do that. I’m assuming a form event but what event type should I use and how would I “capture” when said event happens? Would these “captured” values appear in a BAQ?

Should the custom field(s) be bound to the control I’ll be “capturing” these costs in?

c# preferred lol



You are going to have to define what you are attempting to do a little better. Do you want this event to be user controlled? In that case it would a button with a click event. If you want it to automatically happen, then you will hang it off an event. Which one will be determined by when you want it to save.

All of this is determined by what your use case requires.

Sorry, I lacked a little context behind what the goal is.

Not user controlled. We would like to capture the costs, automatically, when a quote is created or modified, inside of a UD field, for each quote quantity. Ultimately we would like it to work for all quotes in our system but even if we can only capture values moving forward on new quotes that’s okay.

I want to be able to see these captured values inside a BAQ so I can build a SQL report from it, if possible.

I might not know enough about those fields, but is there a reason not to calculate those costs from the quote tables in your query?

1 Like

We have very complex BoMs with price break quantities on some materials. Also, some materials are manufactured and have their costs broken out into subcontract, material burden and labor\burden costs. Calculating the quote costs is almost impossible with all the different variables in our manufacturing processes. I can come really close on some quotes while others I’m hundreds of dollars off. I’ve tried calculating them out but quickly realized that would be a nightmare. I have a feeling that capturing the values and storing them in a UD field would be the better option.

You’re event is going to be on save then. There are a lot of moving pieces and a plethora of options though that might be hard to explain in a single post. You can do this in a BPM or a client side customization. What do you already know how to do?

You could also put an event on field change as well. Bind your UD field to the text box, then update on field change. You will probably need to capture more that one field that way. Save should write the value for you out of the box then.

I’m familiar with client side customization and c#. I already have custom defined fields on the QuoteQty table, with text boxes binded to my UD fields on the Quote Worksheet. I was leaning towards “AfterFieldChange” event. I’m not sure what to write in the event code to make it save the value to my UD field.

private void QuoteQty_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
	// ** Argument Properties and Uses **
	// args.Row["FieldName"]
	// args.Column, args.ProposedValue, args.Row
	// Add Event Handler Code
	switch (args.Column.ColumnName)
	{
		case "TotalBurCost":
         
what goes here? Example: ceburden.txt = epicurrencyeditor.value.ToString();

			break;
	}
}

that’s pretty much it. You should have named your new text box, and you make that equal to the field that’s in the data view.

Use the field help to find the name of the field that you are looking for. In this case it’s total burden cost for the one I picked.

Then you use the object explorer to find the properties on that you need to be able to set it.

1 Like

I only have 5 minutes left before I have to leave so I’ll mess with it tomorrow and let you know how it goes.

Here you go.

        EpiDataView quoteview = (EpiDataView)(oTrans.EpiDataViews["QuoteQty"]);
        Decimal totBurdenCost = (decimal)quoteview.dataView[quoteview.Row]["TotalBurCost"];
        YourTextBoxHere.Value = totBurdenCost;

BTW, this stuff is a lot easier if you pull the customization into VS or VSCode using the extensions that Jose made. Have you played with that yet?

1 Like

I haven’t. I do have VS on my workstation though. Between you, Chris Conn and Jose I’ve picked up a lot of answers just surfing\browsing the forum. So thank you for the help!

1 Like

Ok, so I’ve been corrected(ish). That way will work, but it’s better to use the data_view so that any events that you may make in the future will fire correctly. Use this instead. replace CustomField_c with whatever your UD field is.

        EpiDataView quoteview = (EpiDataView)(oTrans.EpiDataViews["QuoteQty"]);
        Decimal totBurdenCost = (decimal)quoteview.dataView[quoteview.Row]["TotalBurCost"];
        quoteview.dataView[quoteview.Row].BeginEdit();
        quoteview.dataView[quoteview.Row]["CustomField_c"] = totBurdenCost;
        quoteview.dataView[quoteview.Row].EndEdit();
2 Likes

I’ll try it today, when I have a chance, and let you know how it goes. Thanks again!

That didn’t work. So I tried using EpiViewNotification event with NotifyType.Initialize.

		private void edvQuoteQty_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
		{
			// ** Argument Properties and Uses **
			// view.dataView[args.Row]["FieldName"]
			// args.Row, args.Column, args.Sender, args.NotifyType
			// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
			if ((args.NotifyType == EpiTransaction.NotifyType.Initialize))
			{
				if ((args.Row > -1))
				{

EpiDataView quoteview = (EpiDataView)(oTrans.EpiDataViews["QuoteQty"]);
Decimal totBurdenCost = (decimal)quoteview.dataView[quoteview.Row]["TotalBurCost"];
quoteview.dataView[quoteview.Row].BeginEdit();
quoteview.dataView[quoteview.Row]["QtBurden_c"] = totBurdenCost;
quoteview.dataView[quoteview.Row].EndEdit();
				

				}
			}
		}

It now grabs the value and displays it in my text box but it’s not being committed or “captured”. The value does not appear inside a BAQ. Is it even possible to capture these values and store them on the QuoteQty table? I tried adding oTrans.Update() at the end but get a reference missing error.

Dumb question, but I’m assuming that you are hitting “save” before you are looking for it in the BAQ?

Also, if you just type something into that box and hit save, does it commit to the DB?

Save on the customization? Of course. I even close and reopen the forms I’m customizing. This is being done on the quote tracker screen though, perhaps I need to do this on the quote entry screen instead? I can give that a shot. Quote Tracker doesn’t allow me to “save” since nothing is being changed there.

:man_facepalming:… yes. It needs to be in entry. Tracker doesn’t save.

:sweat_smile: Well that makes sense, I was in a haste and wasn’t thinking when I started lol

Ok, start over with entry, and start with just your field /text box and make sure you can type something in and hit save. Once that works, then add your events and the code.

Okay, I started over, using Quote Entry. I have it working now but not the way I was hoping. I built a function and attached it to a button they already use on every quote, to update some other fields. This will work for us moving forward. Below is our solution. Thank you again!

	private void UpdatePrice()
	{
		EpiDataView qm = (EpiDataView)oTrans.EpiDataViews["QuoteQty"];
		Decimal QtBurden = (decimal)qm.dataView[qm.Row]["TotalBurCost"];
		Decimal QtLabor = (decimal)qm.dataView[qm.Row]["TotalLbrCost"];
		Decimal QtMaterial = (decimal)qm.dataView[qm.Row]["TotalMtlCost"];
		Decimal QtSubContract = (decimal)qm.dataView[qm.Row]["TotalSubCost"];
		Decimal QtMtlBurden = (decimal)qm.dataView[qm.Row]["TotalMtlBurCost"];

		EpiDataView qDtl = (EpiDataView)oTrans.EpiDataViews["QuoteDtl"];
		qm.dataView[qm.Row].BeginEdit();
		qm.dataView[qm.Row]["QtBurden_c"] = QtBurden;
		qm.dataView[qm.Row]["QtLabor_c"] = QtLabor;
		qm.dataView[qm.Row]["QtMaterial_c"] = QtMaterial;
		qm.dataView[qm.Row]["QtSubContract_c"] = QtSubContract;
		qm.dataView[qm.Row]["QtMtlBurden_c"] = QtMtlBurden;
		qm.dataView[qm.Row].EndEdit();

		qDtl.dataView[qDtl.Row].BeginEdit();
		qDtl.dataView[qDtl.Row]["QtBurden_c"] = QtBurden;
		qDtl.dataView[qDtl.Row]["QtLabor_c"] = QtLabor;
		qDtl.dataView[qDtl.Row]["QtMaterial_c"] = QtMaterial;
		qDtl.dataView[qDtl.Row]["QtSubContract_c"] = QtSubContract;
		qDtl.dataView[qDtl.Row]["QtMtlBurden_c"] = QtMtlBurden;
		qDtl.dataView[qDtl.Row].EndEdit();
	
	}