Calculate Percentage on Part Load

Can anyone help me do a simple calculation and display it on the part form?

Part.UnitPrice / Part.PrSupPrice_c = %

I could write to field Part.SalesPricePer or just display the calculation on the part form.

image

You can add a custom numeric editor to the screen and set it’s value in code.
Here’s an example setting myCalcNe to UnitPrice / InternalUnitPrice on the Part Initialize.

	private void edvPart_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))
			{
				if ((decimal)view.dataView[args.Row]["InternalUnitPrice"] != 0)
				{

					myCalcNe.Value = (decimal)view.dataView[args.Row]["UnitPrice"] / (decimal)view.dataView[args.Row]["InternalUnitPrice"];
				}
				else
				{
					myCalcNe.Value = 0;
				}
			}
		}
	}

1 Like

Thank you sir!

I added a second check for zero since i was getting divide by zero errors.