Skip to main content
Solved

Customization causing the following error: processing of the field Sat: Specified cast is not valid..


I received good advice about how I could create a custom field to display the total hours for each day of the week in the time card screen. As you can see below, I thought I got it to work properly; however, I keep running into an error message: Error: An error occurred during processing of the field Sat: Specified cast is not valid..

 

Mon Field:

>PXTimeList]
        PXDBInt]
tPXFormula(null, typeof(SumCalc<EPTimeCardExt.usrMondayTotal>))]
)PXUIField(DisplayName = "Mon")]

Monday Hours:

:PXInt]
tPXTimeList(30, 335, ExclusiveValues = false)]
)PXUIField(DisplayName = "Monday Hours", Enabled = false)]

Also tried PXDBInt for Monday hours.

Could I be getting this error message because how Time spent field is being calculated is the following?

/PXInt]
tPXTimeList]
tPXDependsOnFields(typeof(mon), typeof(tue), typeof(wed), typeof(thu), typeof(fri), typeof(sat), typeof(sun))]
)PXUIField(DisplayName = "Time Spent", Enabled = false)]


Not the biggest issue if I can’t get this to work, just wanted to add something to the time sheet for colleagues.

Any advice would be greatly appreciated :)

3 replies

Badge +12

The error you’re getting is referencing the field Sat. Do you have a field Sat defined?

It seems like you may be redefining the Time Spent field. Is this the case? If so, what is the reason for that? It may be the PXDependsOnFields attribute that is causing the problem, since that one does reference Sat.

@darylbowman

Thanks for the quick response :)

Sat looks just like Mon but with Sat

I didn’t touch Sat at all so it’s weird that it’s saying Sat is the one that is causing the error.

[PXTimeList]
        [PXDBInt]
[PXUIField(DisplayName = "Sat")]

 

Do you think If I changed all the mon,tue,wed,thu,fri,sat,sun to have the sumcalc it would fix the problem?

or would I need to figure out how to a new formula to calculate timespent?

Badge +12

In my experience, when something doesn’t go right, go back to the basics. Start with the most basic version of what it is you’re trying to accomplish. For this, start with a single day of the week and comment out the rest. Test that the formulas are working the way you expect and get it to work on the smallest scale. It’s easier to troubleshoot and less can go wrong. When you have it working in its most basic form, then it’s time to scale.

Reply