Call Update method on button click event

I'm on version 10.0.700.4.

Jay

I have customized UD03 entry for a custom table. The one thing that I am not sure how to do it call the update method from a custom button. I want the button click to open a BPM data form. I have the button changing a checkbox to true, which I will us at the condition for the BPM, but I want the button to also call the UD03 Update method. How is this method triggered from a button click in C#.


Sample code would be great.


Jay

1 Like
oTrans.Update();


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Wed, Aug 26, 2015 at 1:03 PM, j.eppersn@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p></p><p><span>I have customized UD03 entry for a custom table. The one thing that I am not sure how to do it call the update method from a custom button. I want the button click to open a BPM data form. I have the button changing a checkbox to true, which I will us at the condition for the BPM, but I want the button to also call the UD03 Update method. How is this method triggered from a button click in C#.</span></p><p><span><br></span></p><p><span>Sample code would be great.</span></p><p><span><br></span></p><p><span>Jay</span></p><p></p>

</div>
 


<div style="color:#fff;min-height:0;"></div>

Thanks, Jose, that seems to have worked. I had tried oTrans.Update; but forgot the () before the semicolon.


Jay

    

I am still having problems with this, I guess. I thought I had the button working, but it isn't doing what I expected. It works fine if I change some other field on the form before the button press, but if I am not actually changing anything, the update method doesn't fire. I was hoping that by changing a checkbox to true before calling the oTrans.Update method, it would allow the method to fire, but it isn't working.


The code compiles and I am not receiving any error message, but the Update method only fires if I change some field on the form before pressing the button.


Here is my event handling code, so far:


  // ** Place Event Handling Code Here **
 

{

edvUD03.dataView[edvUD03.Row]["Checkbox03"] = true;
    {
     oTrans.Update();

     }

}

you need to perform an EpiDataView Notify after you change the checkbox, and or set the RowMod="U"


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Wed, Aug 26, 2015 at 4:03 PM, j.eppersn@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p><span>Â Â Â Â </span></p><p>I am still having problems with this, I guess. I thought I had the button working, but it isn&#39;t doing what I expected. It works fine if I change some other field on the form before the button press, but if I am not actually changing anything, the update method doesn&#39;t fire. I was hoping that by changing a checkbox to true before calling the oTrans.Update method, it would allow the method to fire, but it isn&#39;t working.</p><p><br></p><p>The code compiles and I am not receiving any error message, but the Update method only fires if I change some field on the form before pressing the button.</p><p><br></p><p>Here is my event handling code, so far:</p><p><br></p><p>Â Â // ** Place Event Handling Code Here **<br>Â </p><p>{</p><p>edvUD03.dataView[edvUD03.Row][&quot;Checkbox03&quot;] = true;<br>Â Â Â Â {<br>Â Â Â Â Â oTrans.Update();</p><p>Â Â Â Â  }</p><p>}<br></p><p></p>

</div><span class="ygrps-yiv-2024357227">
 


<div style="color:#fff;min-height:0;"></div>


Something like this? It still doesn't seem to be working. I tried both the EpiDataView.Notify and the RowMod, but neither worked with the way that I have them.


{
  edvUD03.dataView[edvUD03.Row]["Checkbox03"] = true;
   {
   // edvUD03.dataView[edvUD03.Row]["RowMod"] = "U";
   EpiDataView.Notify(args);
    {
    oTrans.Update();
    }
   }
  }

no you need to call teh Notify event on the UD03 EpDataView. There are examples in the listÂ
something like  edvUD03.Notify(new EpiNotifyArgs(otrans,  edvUD03..Row,  edvUD03..Column));


Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Wed, Aug 26, 2015 at 4:58 PM, j.eppersn@... [vantage] <vantage@yahoogroups.com> wrote:

Â
<div>
  
  
  <p></p><p>Something like this? It still doesn&#39;t seem to be working. I tried both the EpiDataView.Notify and the RowMod, but neither worked with the way that I have them.</p><p><br></p><p><span class="ygrps-yiv-1533591950">{<br>Â Â edvUD03.dataView[edvUD03.Row][&quot;Checkbox03&quot;] = true;<br>Â Â Â {<br></span>Â Â Â // edvUD03.dataView[edvUD03.Row][&quot;RowMod&quot;] = &quot;U&quot;;<br>Â Â Â EpiDataView.Notify(args);<br>Â Â Â Â {<br>Â Â Â Â oTrans.Update();<br>Â Â Â Â }<br>Â Â Â }<br>Â Â }<br></p><p></p>

</div><span class="ygrps-yiv-1533591950">
 


<div style="color:#fff;min-height:0;"></div>


This is my update code, but it still isn't functioning correctly...


{
edvUD03.dataView[edvUD03.Row]["Checkbox03"] = true;
     {
     edvUD03.Notify(new EpiNotifyArgs(oTrans, edvUD03.Row, edvUD03.Column));

          {
          oTrans.Update();
          }
   }

}



Thanks for all the help, Jose.


Jay

Try after your update
oTrans.NotifyAll()

Rob Bucek
Production Control Manager
D&S Manufacturing
301 E. Main St. | PO Box 279
Black River Falls, WI 54615
715-284-5376 Ext. 311
Mobile: 715-896-3119
rbucek@...
www.dsmfg.com<http://www.dsmfg.com>

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Wednesday, August 26, 2015 5:15 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Call Update method on button click event



This is my update code, but it still isn't functioning correctly...



{
edvUD03.dataView[edvUD03.Row]["Checkbox03"] = true;
{
edvUD03.Notify(new EpiNotifyArgs(oTrans, edvUD03.Row, edvUD03.Column));

{
oTrans.Update();
}
}

}





Thanks for all the help, Jose.



Jay



[Non-text portions of this message have been removed]
Still nothing. The button sets the checkbox to true, but doesn't seem to actually run the update method to commit the change to the DB (if I run a BAQ after pressing the button, checkbox03 is still false).
I got it!! Thanks to the help from you guys and some Google-Fu, I found a solution that works:

{
edvUD03.dataView[0].BeginEdit();
edvUD03.dataView[edvUD03.Row]["Checkbox03"] = true;
edvUD03.dataView[0].EndEdit();

oTrans.Update();
}

Thanks again for all of the help!

Jay
Help us out, paste the entirety of your code (including the usings). What version are you on?

Rob Bucek
Production Control Manager
D&S Manufacturing
301 E. Main St. | PO Box 279
Black River Falls, WI 54615
715-284-5376 Ext. 311
Mobile: 715-896-3119
rbucek@...
www.dsmfg.com<http://www.dsmfg.com>

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Thursday, August 27, 2015 9:42 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Re: Call Update method on button click event



Still nothing. The button sets the checkbox to true, but doesn't seem to actually run the update method to commit the change to the DB (if I run a BAQ after pressing the button, checkbox03 is still false).



[Non-text portions of this message have been removed]
// **************************************************
// Custom code for UD03Form
// Created: 8/25/2015 9:41:14 AM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Ice.BO;
using Ice.UI;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **

// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **

private EpiDataView edvUD03;

public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization

// End Wizard Added Variable Initialization

// Begin Wizard Added Custom Method Calls

this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
// End Wizard Added Custom Method Calls
edvUD03 = (EpiDataView)oTrans.EpiDataViews["UD03"];

}

public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.btnClose.Click -= new System.EventHandler(this.btnClose_Click);

// End Wizard Added Object Disposal

// Begin Custom Code Disposal

// End Custom Code Disposal
}

private void btnClose_Click(object sender, System.EventArgs args)

{
// ** Place Event Handling Code Here **
edvUD03.dataView[0].BeginEdit();
edvUD03.dataView[edvUD03.Row]["Checkbox03"] = true;
edvUD03.dataView[0].EndEdit();

oTrans.Update();

}

}

1 Like