Code for CheckStateChanged of updatable bit/logic field in EpiGrid Row - Anyone have something?

I have an updatable dashboard with a calculated field of type bit/logic so that a user can select rows to be updated by checking the calculated field.

What I am trying to do is take the weight field in the checked row and add it to a custom field in a tracker panel to keep a running total of the weight for all rows that are checked.

We have to ship full containers to a warehouse and containers can typically hold 40,000LBS of our product. I would like to show the user the total weight of what they have selected so far so that they can use it to make their next decision accordingly (along with other factors).

Since this is a prototype dashboard, a minimal viable product (MVP), I probably shouldn’t even be looking to add this feature, but I feel like it would be cool. For this reason I am wondering if anyone has any code so I don’t have to spend too much time on a custom feature for an MVP. If not, I’ll look to add it later- thanks for reading this :wink:

If anyone sees this and thinks, “why isn’t he using masterpack,” please don’t be concerned. It isn’t working with transfer orders right now.

@jgiese.wci @josecgomez @Banderson @hkeric.wci @NateS @tsmith


programmatically add the sum to the grid? That would be path of least resistance. More elegant solution with a field might a second filtered dataset where your checkbox is checked. Watch that for changes and loop sum your column. So long as you don’t loop the grid it shouldn’t take too long and hang up the screen or anything.

It sounds like you just want to update a field based on your checkbox. You will need a field to store that weight value, either in a UD table, or a UD field in an existing table. This should be doable. Setup your UBAQ to use advanced BPM updating only. You will need a custom action in your BAQ to trigger.

In your BPM code, insert a custom code widget to pull in the starting values for your variables. To select just your rows with checkboxes use something like this:

 foreach (var row in (from ttResults_Row in queryResultDataset.Results where ttResults_Row.Calculated_UpdateRelease == true select ttResults_Row))

//or to get the total rows checked:
var ttResults_xRow = (from ttResults_Row in queryResultDataset.Results where ttResults_Row.Calculated_NewRelease == true select ttResults_Row);

totalrows = ttResults_xRow.Count();

I setup my BPM to loop through each checked row using condition widgets. As it loops, I use an Update Table by Query widget to add the field data I need.

In your dashboard customization code put in a button to trigger your BPM. The button code would be something like this:

		edv = oTrans.Factory("V_Your_Grid_View");
		BAQRunCustomAction(edv, "YourCustomActionName");

//run BAQ action
	 void BAQRunCustomAction(EpiDataView iEdv, string iActionID)
	    BAQDataView BAQView = (BAQDataView)iEdv;
	    Assembly assembly = Assembly.LoadFrom("Ice.Lib.EpiClientLib.dll");
	    Type t = assembly.GetType("Ice.Lib.Framework.BAQUpdater");
	    MethodInfo mi = t.GetMethod("BAQRunCustomAction", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
		mi.Invoke("Ice.Lib.Framework.BAQUpdater", new object[]{BAQView, iActionID});

Good luck with this. Once you get started I think it will be relatively easy to get it working.

With a second filtered dataset you can just use the inbuilt summary total feature of the dashboard and no code will be needed.

How do you get that from the dataset and or infragistics grid?

See below, this is how we have done in some dashboards and grids

I’m open to anything, but @jgiese.wci I was looking to add the weight value to a variable every time a row is marked as shipped. I don’t think another grid field would make a ton of sense to display the total weight of all checked rows.

What are you and @Vinaykamboj talking about with a filtered dataset? Do you have some posts on here or an example?

@NateS I am all set with the setup, I am using a custom advanced BAQ update that runs through the results and for each row where the checked checkbox is updated and true, it marks the pack shipped and links the pack to a BOL. Now I am just working on ancillary features of the dashboard like total weight.

Does anyone have a check state checked sample event code for a checkbox in an epigrid row?

Sure i mentioned the same that you could just use the summing of the grid, but my impression is that is not what @utaylor was looking for.

Not a grid field it’s a tracker field i’m talking about. You could either add another grid panel filtered down to just checked true you could loop that dataview to get your sum of weights and hide the grid, or create the filtered dataview in custom code and sum the values from that. It just gives you something to hing off. I wouldn’t use any grid events or you’re asking for performance issues. Whatever you do, do it in the dataviews not the UI.

Thanks, yes I just realized I was making it a lot harder than it needed to be since there is a dataview :sweat_smile:

I am playing around with it now, I will get back to you all on the finished product. I’ll upload a video of it.