Add Time Editor to an updatable dashboard

I’m working in an updatable dashboard that displays information from Time and Expense entry screen LaborHed table (we are only changing existing record), some of the updatable fields are the Act Clock In Time, Act. Clock Out Time etc. which are displayed in hours.minutes for example 11.50 is equals to 11:30 AM and 23.50 to 11:30 PM, of the requirements is to display the time in hh.mm.xm format (image 2).

I was thinking in adding a time editor to the dashboard in order to display the required format so I created a customization based on my dashboard assembly added the time editor and tried to link it to the time column of the grid but I got the following error which is related to the data of the column (I believe in the source code time is converted to decimal in order to store it in the DB).

Another idea that would be to display the format for the time like hh.mm.xm to string but I would need to convert it to time in order to store the updated value in the database.

Any idea or suggestion about this requirement would be appreciate it (I tried to add more images but only one is allowed).

Thanks

DID YOU KNOW… that in the BAQ Editor, on the updatable fields tab, that there is an advanced Field editor? You can change how the fields are edited there (including adding combo boxes, etc). I THINK that you can choose the date/time editor there (but I am going off memory)

2 Likes

You can do this but the BAQ does not support making this behave like a TimeEditor field. Below is the end result of how it would look in an updatable dashboard and below that are instructions for doing this.

1 - Create a calculated column in your BAQ. This will convert the decimal value to a datetime (time format) value

2 - In the General Properties for the Update make the calculated column and column you want to update as updatable. Set the Format of the calculated column to {time} using the advanced column editor

2.5 - Now you will need to add some code for going from datetime back to decimal when updating the proper column

3 - Assuming you have made a dashboard from this Baq make it an assembly and tie to a menu item so you can apply a customization.

4 - In the customization code you will need to add some custom code. I assume you know where to put these statements and if that is incorrect let me know and I can add the full code.

using Infragistics.Win;
Ice.Lib.Framework.EpiUltraGrid myGrid;
myGrid = (EpiUltraGrid)csm.GetNativeControlReference("bb5c8193-0868-4d90-ab62-c56fb831b0e9"); // Add your GUID
// Add to Form Load Event
EditorWithMask TimeEditor = new EditorWithMask();
TimeEditor.SpinButtonDisplayStyle = SpinButtonDisplayStyle.OnRight;
myGrid.DisplayLayout.Bands[0].Columns["Calculated_ClockInTimeShow"].Editor = TimeEditor;
7 Likes

This is the image 2

And error

If you follow what I posted there should be no problems like this anymore.

Thank you Tim, yes I knew that but I thought it only applied for combos.

I’m going to take a look on it.

Thanks a bunch!

Thank you @danbedwards you’re the man! It worked like a charm. I just did a small change when converting from datetime to decimal, we need to check the Time Format from Company Configuration to know if we are going to divide either by hundredths (100) or minutes (60).

Thanks again!

I am doing a similar thing here, however I am using a UDF for the delivery time.

On the Updatable BAQ, I have set the Format to {time} and the Editor Type: Common Editor

However, on the dashboard, the control shows a calendar. But when you type, only the time can be typed in.

image

Do I have to create a calculated field or is there a quick way of making the control to be a Time editor?

@TobyLai you need to create a customization for you dashboard like step 3 and 4 posted by Dan.

Thanks

Hi,
I thought I’d share some tweaks we did on our end to make it work in a 24h format. On our end, we modify the LaborDtl table, but same principle.

In the Calculated Field SQL Editor we used 2 fields :

DATEADD(s, (LaborDtl.ClockinTime * 3600), 0)
and
DATEADD(s, (LaborDtl.ClockOutTime * 3600), 0)

Then in the Business Object Update C# Expression :

LaborDtl.ClockInTime

Convert.ToDecimal(Convert.ToDateTime(ttResult.Calculated_ClockInTimeShow).Hour) + (Convert.ToDecimal(Convert.ToDateTime(ttResult.Calculated_ClockInTimeShow).Minute) / 60)

LaborDtl.ClockOutTime

Convert.ToDecimal(Convert.ToDateTime(ttResult.Calculated_ClockOutTimeShow).Hour) + (Convert.ToDecimal(Convert.ToDateTime(ttResult.Calculated_ClockOutTimeShow).Minute) / 60)

I am not sure where to add the customization code, if you could help me on that to apply on the dashboard.

Should I add it to the InitializeCustomCode() section?

1 Like