Good afternoon, everyone!
I hope you all had a great holiday. Today I am back at an old dashboard that I gave up on in the past.
My goal is to simply add up the OpenValue field for each row that is checked in the dashboard. I have built the uBAQ to include a blank checkbox (calculated as 0). I think that I need to use an EpiViewNotification event from Wizards > Form Event Wizard. But can’t find a wizard that triggers on a field change. (I see the Before/After field change events there, but my table is not listed.**)
I would like to trigger on the user clicking a check box in the uBAQ’s grid. Once triggered, the event should review all the other rows with a check box and add up the OpenValue column for just those that are checked.
Once I have that value, I would like to place it into a text field for the user to see. Ideally the user just clicks a bunch of rows then the text box shows a sort of running total of those checked. If the user unchecks, the total should update accordingly.
Questions:
How do I trigger on the user clicking a calculated field checkbox on the uBAQs grid inside a dashboard?
Once triggered, I have to pull the value from the checked box and store it someplace so that I can add it to the rest of the values that are checked. Where do I store the variable that holds the value to display in the textbox?
Eventually, once this is working correctly the UBAQ will use those check boxes to “what-if” schedule the jobs that the user selected using a new date. This part of my uBAQ works just fine. I just need to use those check boxes to pull a total before I run my custom action to do the WI scheduling.
** My dashboard is actually made of 2 BAQs. One UBAQ that does the WI scheduling and the checkboxes, and another BAQ (not UBAQ) that just shows a summary from the ResourceTimeUsed table showing the updated WI schedule load. So, I can’t use the Before/After FieldChange events, because the only tables listed are BpmData, Client, and Results. I tried to use the template created by the AfterFieldChange Event and swap in my dataview that has the checkboxes. But bastardizing the wizard template never works out the way you want it to…
I’m not understanding why you can’t use the results table? I’m doing basically the same thing in one of my dashboards, and using the results table. You’ll probably have to show more details for anyone to understand what you are tying to do.
The fields don’t exist in my results table. The results table seems to only have the fields from my second BAQ, and none of the fields from my first UBAQ. Maybe if i build the dashboard the other way around, and add my UBAQ first, then my regular BAQ?
For S’s and giggles, add that that guy to MessageBox.Show() after you make an after field change event, (pick whatever random field just to make the event), then see if anything pops when you change what you want to change. Put it before the switch so it goes off without any filtering.
I should be more specific. When I added that message box, I got a popup that just says SysRowID, it pops up a bunch of times. Maybe as many times as I have columns in one of my tables! But clicking my check box inside the ubaq doesn’t seem to trigger any field change, at least not in Results.
Yes! After I deleted my second BAQ inside my dashboard, the results table now shows the fields I need. So strange! I guess I have to have them use two dashboards instead of one.
public class Script
{
public EpiTextBox myString;
decimal totOpenValue;
// ** 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 **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.Results_Column.ColumnChanged += new DataColumnChangeEventHandler(this.Results_AfterFieldChange);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.Results_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.Results_AfterFieldChange);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void Results_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
EpiDataView edv = (EpiDataView)this.oTrans.EpiDataViews["Results"];
switch (args.Column.ColumnName)
{
case "Calculated_CheckBox":
MessageBox.Show(args.Column.ColumnName.ToString());
foreach (DataRow x in edv.dataView)
{
MessageBox.Show(((decimal)x["Calculated_TotalOpenValue"]).ToString());
if((bool)x["Calculated_CheckBox"] == true)
{
MessageBox.Show(((decimal)x["Calculated_TotalOpenValue"]).ToString());
totOpenValue += (decimal)x["Calculated_TotalOpenValue"];
}
}
myString = (Ice.Lib.Framework.EpiTextBox)csm.GetNativeControlReference("f510f4b0-adb9-4259-8b83-f3d3737d3c89");
myString.Value = totOpenValue.ToString();
break;
}
}
}
The Message box after the case shows up, but neither of the message boxes inside the foreach shows up. You can see I defined edv inside the event. Should I define this outside the event, or should it be defined to something else?
Also tried to used this instead with similar lack of results:
foreach (DataRowView x in edv.dataView)
I replaced the first messagebox that was showing up with this, and now it doesn’t show up anymore, but compiles fine and produces no error: