Prompt for Save when changes made in UDashboard when Refresh Tool Clicked

Hi Everyone,

Looking for a little bit of help with what I think is a fairly simple task. I have an updateable dashboard which when the Refresh tool is clicked I want to have a message box appear prompting the user to save if any of the rows have been updated.

I’ve figured out the message box that when Yes is clicked it saves and when No is clicked it just carries on with the refresh however I haven’t quite been able to figure out the custom code that will query the grid for updated rows.

Any help would be very much appreciated as I am fairly new to C# and still find it a little mind boggling at times.

I’m thinking this thread might give you some ideas…

Thanks Bruce! I was able to get the Row Rules working which is a great visual cue that there is something that has been modified.

However I’d also like to have a Message box pop up at the same time that prompts them to Save.

Is there a way to accomplish this through the Column Value Changes Row Rule?

I was thinking possibly having Custom Code during the Row Rule that would populate an Edited_c UD field. That I could then Query.

However with my limited C# knowledge, I’m finding it a bit tricky figuring out the CODE to populate a field on Column Value Change.

Any help would be greatly appreciated :slight_smile:

If I get time I’ll play around with it but… can’t promise anything.
In the meantime, maybe someone else has some ideas, has already tackled this?

For now,… hmmm, rather than populating a UD field, I’m wondering if a variable might work?
Something like this…

Set a bool variable to true whenever one of your fields is changed
Then when the refresh tool is clicked, check if bool = true and then show messagebox with buttons

  • “Yes” continue with the refresh and reset bool to false
  • “Cancel”, stop the refresh, leave the bool as true.

Also, sounds like you’re still learning how to code in E10?
If so, here is a link to some toolbar basics that I liked.


i.e. maybe you could start with seeing what is being clicked, and then adding your handling?
// add this to the using
using Infragistics.Win.UltraWinToolbars;

// and use the Wizard to generate this
private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{
// and add your code, e.g. a simple messagebox to show what tool was clicked
MessageBox.Show(((Infragistics.Win.UltraWinToolbars.ToolEventArgs)(args)).Tool.Key);
}

P.S.
This link might give you some ideas too.

Thanks so much Bruce!

Yes, those were my thoughts exactly. I created a bool UD field. I have it being populated to true based off the Value Change Row Rule.

I then query that field and if the value equals true it prompts the Yes/No message box which will Save on Yes and Refresh on No.

I am just struggling to find the proper code to query the field though.

I’ll keep everyone posted if I figure it out.

Thanks so much for the resources, I will check those out :slight_smile:

Yeah, I have a routine that checks for a dirty row after refresh is clicked.
Still needs a messagebox w/yes,cancel handling though
So maybe if I get a slow patch this week, will flesh this out a little more.

And…
I may start another thread, asking if EpiDataViews keep track of their state, i.e. know if they contain dirty row(s)?
If they do… would make this a lot simpler.
One of those things… seems like it should be obvious but I’ve never had reason to think too much about it before.

That would be great.

And yes! that would make things soooo much simpler.

Try to use the before toolclick event, look for a refresh button press and then evaluate if there is a changed row in the data set. If there is throw the native save dialog.

EpiString.DialogInfo di = EpiString.GetDialogInfo("UpdateOnFormClose");
var res = EpiCheckMessageBox.Show(di.Message, di.Title, di.Buttons);
if(res.Result == DialogResult.Yes)
{
    // SAVE CODE
}

Thanks…

And… wonder if you know how/if possible to check for dirty row(s) in the epidataview used by updateable dashboard?

Loop the dataview rows and look for rowmod = P

Hi Joshua,

having trouble figuring out the Code for this specifically. Would you be able to provide an example. :slight_smile:

Code to loop a dataview. Just add a condition looking for rowmod value vs setting a value like he is in his example.

Thinking this thread that might help too…

Hmmmm… just noticed “before” and “after” toolclick events don’t seem to be working for UBAQ customizations.
The toolclick event does fire though.
TBD if that is just the way it is, or maybe a version thing.

And… you might also be interested in this Knowledge Base article on the EpicCare stie:
https://epicorcs.service-now.com/epiccare/?id=epiccare_kb_article&sys_id=116f85931be308188b19fdd51a4bcbe0

“Updateable BAQs Dataset when using GetList, RunCustomAction and Update methods - KB0091912”

So… within a form customization for UBAQ

  • appears RowMod “P” doesn’t show up until the ttResults… downstream, BPM?
  • at least that is what it looked like on a test system - running version 10.1.6

Admittedly I havent read the whole thread here, but if I am picking up the context, I have found that if you want perform actions against ALL rows in a UBAQ you need ACTIONS as Update will only work on modified rows. You can however use an action to modify all rows in a UBAQ programmatically.

Specific to the OP, instead of before tool click, cant you do a BeforeAdapter method?

Thanks, sounded like a good idea, but…
when I looked at the FormEvent Wizard - BeforeAdapterMethod the Adapters dropdown was blank.

  • on a UBAQ form customization,

This one just caught my interest… SheaM made the original post, not sure still needs it.

I keep poking around when I get a minute… just because I haven’t really looked at UBAQ form customizations too much before.
Starting to realize the differences now, kind of making sense why.

I wonder if you can code your own before adapter method. As long as you can get ahold of the DynamicQuery adapter in the form you should be able to. Also, this is a deployed Dash right?

Thanks for all of the assistance guys!

Like Bruce has previously said in his posts, a lot of the suggestions haven’t panned out due to some Epicor bugs/issues related to the UBAQ.

I have actually managed to ALMOST completely solve my original problem through creating a UD checkbox field that is toggled to TRUE through a Value Change Row Rule.

I then have code on a Tool Click Event that will query each Row for the TRUE fields and Prompt a YES/NO message box that will save when YES is selected.

Then in the Background I have a Data Directive that sets the UD field to False every time there is an updated row in that table.

It’s a little clunky but I had a deadline and it seems to be doing the trick.

The only problem now is the code I have to check each Row for a True checkbox is using a foreach statement which is then showing a save prompt for EVERY row that has been changed.

Currently working on modifying that to a Count if I can, Count every True and if the Count is greater than 0 then show the save prompt

Yes…

Instead of:

foreach()
{
 if(true) MessageBox
}

You should be able to do something like this in you ToolClick

bool hasChange = false;
foreach()
{
 if(true) 
{
  hasChange = true;
  break;
}
}

 if(hasChange) MessageBox

There are more effecient ways to do it without a loop, but this is quickest from where it seems you are now