Calculated field updating on Custom Form

Sorry for the delay in responding but I have been off. This did make sense and I had already tried it working on your previous advise, however, all that happens is I get the 'fire' message but the field is not updated. There is no error message appearing on the form and I can't see anything on the server log either?


--- In vantage@yahoogroups.com, "jckinneman" <jckinneman@...> wrote:
>
> Similar issue, you are trying to assign a double to the control itself not the value property.
>
> Weak analogy while a car needs gasoline to run it has to be put in the tank for the car to be able to process it. Car = gas doesn't work but Car.Tank = gas works.
>
> Not all assignments get checked as part of the test code routine, this one appears to only show up at run-time.
>
> Try something like this.
> numUnitPrice.Value = numUnitCost.Value * ((100 - umGrossMargin.Value) / 100)
>
> Jim Kinneman
> Encompass Solutions, Inc.
>
> --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> >
> > Thank you for replying... the error was showing when I tested the code but your explanation made sense and the code is now compiling but I am getting this message when it acutally fires:
> >
> > The following application error was encountered:
> >
> > Unable to cast object of type 'System.Double' to type 'Epicor.Mfg.UI.FrameWork.EpiCurrencyEditor'.
> >
> > I know 2 of the fields are currency and one is numeric - can I not calculate using both types even though they are numbers? Or am I missing something else? Thanks.
> >
> >
> > --- In vantage@yahoogroups.com, "jckinneman" <jckinneman@> wrote:
> > >
> > > I believe you are referring to the actual control instead of the property on the control.
> > >
> > > Use numGrossMargin.value instead of just numGrossMargin.
> > >
> > > Within embedded you can run a test code to validate the syntax of your code which may give an error message more helpful.
> > >
> > > Jim Kinneman
> > > Encompass Solutions, Inc
> > > --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> > > >
> > > > Our commercial department have requested that when they enter a quote line they can then just enter a Gross Margin value for the system to take the Unit Cost and update the Quoted Unit Price... I have updated the form using QuoteDtl.Number01 for the gross margin value and have put the following code against this field after changes, but am getting an error:
> > > >
> > > > Operator '-' is not defined for types 'Integer' and 'Epicor.Mfg.UI.FrameWork.EpiNumericEditor'.
> > > >
> > > > Any advice appreciated - we're on Vantage 8.03.409a.
> > > >
> > > >
> > > > Private Sub QuoteDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles QuoteDtl_Column.ColumnChanged
> > > > '// ** Argument Properties and Uses **
> > > > '// args.Row("[FieldName]")
> > > > '// args.Column, args.ProposedValue, args.Row
> > > > '
> > > > 'Add Event Handler Code
> > > > '
> > > > Select Case args.Column.ColumnName
> > > >
> > > > Case "Number01"
> > > >
> > > > Dim numUnitCost As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("399bb322-dfc2-4600-beed-53ef88b6f9fa"),EpiCurrencyEditor)
> > > > Dim numUnitPrice As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("459a970c-cd6a-457e-8d41-2d0bfc73d63d"),EpiCurrencyEditor)
> > > > Dim numGrossMargin As EpiNumericEditor = ctype(csm.GetNativeControlReference("0df98425-bbee-4d85-8595-1ae5ccd45ad4"),EpiNumericEditor)
> > > >
> > > > numUnitPrice = numUnitCost * ((100 - numGrossMargin) / 100)
> > > >
> > > > Case Else
> > > >
> > > > End Select
> > > >
> > > > End Sub
> > > >
> > >
> >
>
Our commercial department have requested that when they enter a quote line they can then just enter a Gross Margin value for the system to take the Unit Cost and update the Quoted Unit Price... I have updated the form using QuoteDtl.Number01 for the gross margin value and have put the following code against this field after changes, but am getting an error:

Operator '-' is not defined for types 'Integer' and 'Epicor.Mfg.UI.FrameWork.EpiNumericEditor'.

Any advice appreciated - we're on Vantage 8.03.409a.


Private Sub QuoteDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles QuoteDtl_Column.ColumnChanged
'// ** Argument Properties and Uses **
'// args.Row("[FieldName]")
'// args.Column, args.ProposedValue, args.Row
'
'Add Event Handler Code
'
Select Case args.Column.ColumnName

Case "Number01"

Dim numUnitCost As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("399bb322-dfc2-4600-beed-53ef88b6f9fa"),EpiCurrencyEditor)
Dim numUnitPrice As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("459a970c-cd6a-457e-8d41-2d0bfc73d63d"),EpiCurrencyEditor)
Dim numGrossMargin As EpiNumericEditor = ctype(csm.GetNativeControlReference("0df98425-bbee-4d85-8595-1ae5ccd45ad4"),EpiNumericEditor)

numUnitPrice = numUnitCost * ((100 - numGrossMargin) / 100)

Case Else

End Select

End Sub
I believe you are referring to the actual control instead of the property on the control.

Use numGrossMargin.value instead of just numGrossMargin.

Within embedded you can run a test code to validate the syntax of your code which may give an error message more helpful.

Jim Kinneman
Encompass Solutions, Inc
--- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@...> wrote:
>
> Our commercial department have requested that when they enter a quote line they can then just enter a Gross Margin value for the system to take the Unit Cost and update the Quoted Unit Price... I have updated the form using QuoteDtl.Number01 for the gross margin value and have put the following code against this field after changes, but am getting an error:
>
> Operator '-' is not defined for types 'Integer' and 'Epicor.Mfg.UI.FrameWork.EpiNumericEditor'.
>
> Any advice appreciated - we're on Vantage 8.03.409a.
>
>
> Private Sub QuoteDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles QuoteDtl_Column.ColumnChanged
> '// ** Argument Properties and Uses **
> '// args.Row("[FieldName]")
> '// args.Column, args.ProposedValue, args.Row
> '
> 'Add Event Handler Code
> '
> Select Case args.Column.ColumnName
>
> Case "Number01"
>
> Dim numUnitCost As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("399bb322-dfc2-4600-beed-53ef88b6f9fa"),EpiCurrencyEditor)
> Dim numUnitPrice As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("459a970c-cd6a-457e-8d41-2d0bfc73d63d"),EpiCurrencyEditor)
> Dim numGrossMargin As EpiNumericEditor = ctype(csm.GetNativeControlReference("0df98425-bbee-4d85-8595-1ae5ccd45ad4"),EpiNumericEditor)
>
> numUnitPrice = numUnitCost * ((100 - numGrossMargin) / 100)
>
> Case Else
>
> End Select
>
> End Sub
>
Thank you for replying... the error was showing when I tested the code but your explanation made sense and the code is now compiling but I am getting this message when it acutally fires:

The following application error was encountered:

Unable to cast object of type 'System.Double' to type 'Epicor.Mfg.UI.FrameWork.EpiCurrencyEditor'.

I know 2 of the fields are currency and one is numeric - can I not calculate using both types even though they are numbers? Or am I missing something else? Thanks.


--- In vantage@yahoogroups.com, "jckinneman" <jckinneman@...> wrote:
>
> I believe you are referring to the actual control instead of the property on the control.
>
> Use numGrossMargin.value instead of just numGrossMargin.
>
> Within embedded you can run a test code to validate the syntax of your code which may give an error message more helpful.
>
> Jim Kinneman
> Encompass Solutions, Inc
> --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> >
> > Our commercial department have requested that when they enter a quote line they can then just enter a Gross Margin value for the system to take the Unit Cost and update the Quoted Unit Price... I have updated the form using QuoteDtl.Number01 for the gross margin value and have put the following code against this field after changes, but am getting an error:
> >
> > Operator '-' is not defined for types 'Integer' and 'Epicor.Mfg.UI.FrameWork.EpiNumericEditor'.
> >
> > Any advice appreciated - we're on Vantage 8.03.409a.
> >
> >
> > Private Sub QuoteDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles QuoteDtl_Column.ColumnChanged
> > '// ** Argument Properties and Uses **
> > '// args.Row("[FieldName]")
> > '// args.Column, args.ProposedValue, args.Row
> > '
> > 'Add Event Handler Code
> > '
> > Select Case args.Column.ColumnName
> >
> > Case "Number01"
> >
> > Dim numUnitCost As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("399bb322-dfc2-4600-beed-53ef88b6f9fa"),EpiCurrencyEditor)
> > Dim numUnitPrice As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("459a970c-cd6a-457e-8d41-2d0bfc73d63d"),EpiCurrencyEditor)
> > Dim numGrossMargin As EpiNumericEditor = ctype(csm.GetNativeControlReference("0df98425-bbee-4d85-8595-1ae5ccd45ad4"),EpiNumericEditor)
> >
> > numUnitPrice = numUnitCost * ((100 - numGrossMargin) / 100)
> >
> > Case Else
> >
> > End Select
> >
> > End Sub
> >
>
Similar issue, you are trying to assign a double to the control itself not the value property.

Weak analogy while a car needs gasoline to run it has to be put in the tank for the car to be able to process it. Car = gas doesn't work but Car.Tank = gas works.

Not all assignments get checked as part of the test code routine, this one appears to only show up at run-time.

Try something like this.
numUnitPrice.Value = numUnitCost.Value * ((100 - umGrossMargin.Value) / 100)

Jim Kinneman
Encompass Solutions, Inc.

--- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@...> wrote:
>
> Thank you for replying... the error was showing when I tested the code but your explanation made sense and the code is now compiling but I am getting this message when it acutally fires:
>
> The following application error was encountered:
>
> Unable to cast object of type 'System.Double' to type 'Epicor.Mfg.UI.FrameWork.EpiCurrencyEditor'.
>
> I know 2 of the fields are currency and one is numeric - can I not calculate using both types even though they are numbers? Or am I missing something else? Thanks.
>
>
> --- In vantage@yahoogroups.com, "jckinneman" <jckinneman@> wrote:
> >
> > I believe you are referring to the actual control instead of the property on the control.
> >
> > Use numGrossMargin.value instead of just numGrossMargin.
> >
> > Within embedded you can run a test code to validate the syntax of your code which may give an error message more helpful.
> >
> > Jim Kinneman
> > Encompass Solutions, Inc
> > --- In vantage@yahoogroups.com, "tracy.tmat" <tracy.smith@> wrote:
> > >
> > > Our commercial department have requested that when they enter a quote line they can then just enter a Gross Margin value for the system to take the Unit Cost and update the Quoted Unit Price... I have updated the form using QuoteDtl.Number01 for the gross margin value and have put the following code against this field after changes, but am getting an error:
> > >
> > > Operator '-' is not defined for types 'Integer' and 'Epicor.Mfg.UI.FrameWork.EpiNumericEditor'.
> > >
> > > Any advice appreciated - we're on Vantage 8.03.409a.
> > >
> > >
> > > Private Sub QuoteDtl_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles QuoteDtl_Column.ColumnChanged
> > > '// ** Argument Properties and Uses **
> > > '// args.Row("[FieldName]")
> > > '// args.Column, args.ProposedValue, args.Row
> > > '
> > > 'Add Event Handler Code
> > > '
> > > Select Case args.Column.ColumnName
> > >
> > > Case "Number01"
> > >
> > > Dim numUnitCost As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("399bb322-dfc2-4600-beed-53ef88b6f9fa"),EpiCurrencyEditor)
> > > Dim numUnitPrice As EpiCurrencyEditor = ctype(csm.GetNativeControlReference("459a970c-cd6a-457e-8d41-2d0bfc73d63d"),EpiCurrencyEditor)
> > > Dim numGrossMargin As EpiNumericEditor = ctype(csm.GetNativeControlReference("0df98425-bbee-4d85-8595-1ae5ccd45ad4"),EpiNumericEditor)
> > >
> > > numUnitPrice = numUnitCost * ((100 - numGrossMargin) / 100)
> > >
> > > Case Else
> > >
> > > End Select
> > >
> > > End Sub
> > >
> >
>