Update fields from a Dashboard with code

Hi all,

I’m trying to programmatically update a comment field or a UD field when I scan a pack number.

What I’m trying to accomplish is: We have packslips (printed paper) with the packnumber that is barcoded, we then have an employee scan that barcode, that will then have a prompt always available dashboard to receive the scanned packnumber (see image) which will then update a field (probably UD field) within the ShipDtl table with the datetime stamp or the same pack number.

[barcode scanner will be set to hit F5 (refresh) after scan - or may need to programmatically make the prompt available for entry again]

I’ve tried several from event type and I’m not able to trigger my test message box when I input a packnumber via barcode scanner.

private void V_Raw_PackScan_1View_AfterRowChange(EpiRowChangedArgs args)

private void Results_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)

A bit of snips I’ve tried.

var hasPack = vwMainGrid.SelectedRow["ShipHead_PackNum"];
		if (hasPack != DBNull.Value)
		{
currentRow = vwMainGrid.Row;
		if (vwMainGrid.Row < 0)

Perhaps I’m trying to do this the wrong way? BPM data fill after event?

We’re hosted.

Thanks,

K.

Hi Kyle,

Are you using an updatable dashboard based on an updateable BAQ? If so, could the BPM directives configuration on the updateable query help get you where you need to go with field update? I have found these useful for making default settings when user has entered data into updateable dashboard…

Nancy

Hi Nancy,

Thank you for getting back to me on this.

I’m using an updatable BAQ with an updatable dashboard.

Which method you think would work? I’ve tried with getlist, fieldvalidate, but it updates every pack rather than the pack that is selected. - also which processing?

My goal is to have an employee simply scan the pack on the paper, have it input the pack number into the parameter for the dashboard, and also fill out and save the pack number to a field in the dashboard.

K.

I was thinking maybe Field update… Put a condition that it’s running on the pack number update and then use bpm to set your UD fields as needed.

@kyle.l I think your are posting how to fix my process as opposed to how to solve the issue as @Mark_Wonsil referenced the the other day.

You don’t need parameters just a tracker view to filter or leave it wide open. The field or even a calculated field can be updatable and with a short amount of code on update this can be done. I think you want to put the info on ShipHead unless it is different for each line of the pack.

/* update ShipHead */

foreach (var ttResultsRow in ttResults.Where(row=> !row.Unchanged()))
{
    
    var ShipHead = Db.ShipHead.Where(row=> row.Company == CompanyID && row.SysRowID == ttResultsRow.ShipHead_SysRowID).FirstOrDefault();
    if (ShipHead != null)
    {
        ShipHead.SetUDField<string>("UDField,ttResultsRow.ShipHead_UDField);
     
    }
}

Hi Greg,

Thanks for the reply.

I’m having a bit of trouble implemting this code in the dashboard tracker view.

What would be the best call method for this and I’m receiving an embedded error when I try a row change method.

image

I’ve changed it to update the ShipDtl, since that’s where the Packnumbers is located.

private void V_Raw_PackScan_1View_AfterRowChange(EpiRowChangedArgs args)

		{
   foreach (var ttResultsRow in ttResults.Where(row=> !row.Unchanged()))
    
   
	if (ShipDtl != null)
    	var ShipDtl = Db.ShipDtl.Where(row=> row.Company == CompanyID && row.SysRowID == ttResultsRow.ShipDtl_SysRowID).FirstOrDefault();
        ShipDtl.SetUDField<string>("ShipDtl_ShipComment,ttResultsRow.ShipDtl_ShipComment");
     
    	}
	
}

Thanks,
K

@kyle.l You are making this more complex than is needed. Attached is a working dashboard and baq for this. If you are going to update the ShipComment then that is not a UD field. the code is on Update.

Enter packnum, click refresh, enter comment click save. If you make the results all packs for a day then as they move to another row it will save.

udash sample.dbd (172.8 KB)

Hi Greg,

My goal was to programmatically enter either the same packnumber or datetime into the comment field when the pack number is scanned. The idea is to have this tracker view you sent open at all times, and an employee will simply scan the packnumber while they’re away from the PC, (Bluetooth Scanner). we need to know what time the pack was scanned, this info would then be stored either in the UD field or comment field on that specific pack.

I would have the barcode scanner prefix set to clear, , carriage return. This process should trigger an update to the comment field with with the current date and time.

Thank you for responding,

Enjoy your weekend. :smiley:

K.

@kyle.l I think this can be done with a ubaq just on a UD table with allow new record and little or no screen customizing.

Have one field on the grid for the packnum. Leave one blank row in the UD table and auto load the dashboard on open. or on load call add new.
The enter from the scanner will advance the grid and put the packnum into the update. The code will call the pack line(s) by packnum and update the comment. Cursor should be in the grid ready for the next scan.

I have a similar process in a application I wrote, just trying to implement this bit into Epicor.

I will try with the form wizard, and as Nancy suggested, I will experiment with BPM.

private void txtbox1_KeyPress(object sender, KeyPressEventArgs e)
{
try
{

            this.txtbox1.Text.Trim(), "'" };
            string str = string.Concat(strArrays);
            if ((Strings.Asc(e.KeyChar) == 13 || Strings.Asc(e.KeyChar) == 8 || Versioned.IsNumeric(e.KeyChar) ? false : true))
            {
                MessageBox.Show("Enter Pack");
                e.Handled = true;
            }
            if (e.KeyChar == '\r')
            {
                if (this.txtbox1.Text.Length >= 8)
                {
                    if (!this.Pack(this.txtbox1.Text))
                    {
                       
                        return;
                    }
                    else
                    {
                        this.executequery(str);
                       // this.lblmessage.Text = "Record updated successfully";
                        this.txtbox1.Clear();
                    }
                }
            }
        }
        catch (Exception exception)
        {
            ProjectData.SetProjectError(exception);
            Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
            ProjectData.ClearProjectError();
            return;
        }
    }
}

Hi Greg,

Happy New Year,

I’m still unsuccessful with this project. Perhaps I’ve tried one too many different methods for this task.

K

I got it working using DynamicQuery

1 Like