Call BAQ in C# and build a CSV file

So I’m looking at doing some more printing to bartender. I have most of the pieces that I need (thanks to @Chris_Conn!) to get it working. One thing that I would like to explore is to run a BAQ and populate the CSV to write out at the time of the button click. The way I did the printing before, I needed the BAQ to populate a grid, which I could do now, but I would like to keep the user view as clean as possible, and I think would be best for performance to only call this extra BAQ when it’s needed for printing (?maybe?). I would like to pass the selection of a simplified/grouped/summed grid to be the parameters or criteria. I this case it’s basically the job number on the overview grid. That’s what I don’t know how do.

Or is this approach unnecessarily complicated, and should I just add a BAQ and grid view to the dashboard and hide the grid so the user doesn’t see it? This would mean that this grid is being populated and constantly being filtered as the user is changing the focus on his overview grid, but maybe that’s not a big deal? If I do it this way, I should have all of the pieces that I need to make this work.

Thoughts?

1 Like

Using the previous code for BAQ to grid you can do this to access the results of the BAQ (instead of feeding them to a grid). You just make sure to use the ‘official’ baq column names (in my case - I am accessing the SysPrinter_NetworkPath column from the BAQ Printer_By_Company_CC)

		//---- Setup printer list-----
		DynamicQueryAdapter dqa = new DynamicQueryAdapter(oTrans);
		dqa.BOConnect();
		QueryExecutionDataSet qeds = dqa.GetQueryExecutionParametersByID("Printer_By_Company_CC");
		qeds.ExecutionParameter.Clear();
		qeds.ExecutionParameter.AddExecutionParameterRow("COMPANY",((Ice.Core.Session)oTrans.Session).CompanyID,"nvarchar",false,Guid.NewGuid(),"A");
		dqa.ExecuteByID("Printer_By_Company_CC",qeds);
		
	
	
	foreach(DataRow row in dqa.QueryResults.Tables["Results"].Rows)
	{  //iterate each row and do something - display in this case
		MessageBox.Show(row["SysPrinter_NetworkPath"].ToString());
	}
1 Like

Ok, I’m working on getting some of this set up and I have some customization questions. What I have set up so far is the the top level dashboard which is an overview by job with some basic filters on it. I deployed that, and through customization I used sheet wizard to add 2 dashboards (on on each tab) that subcscribes to the job number in the selected row on the parent dashboard. All of the viewing part of it works great.

Now I need to start adding the controls for the printer selection, buttons, and number of copies. I added those on the child dashboards within the tracker customization. It seems easier to me to break it up into smaller chunks like that. However what I am finding is that the controls don’t seem to flow up to the customization well. Stuff if kind of there, but no really very easy to see what’s going on, and not everything shows up.

Should I be adding all of the controls for the customization with the customization instead of at the child dashboard level? I’m pretty sure that I answered my on question considering it looks like the parent dashboard controls show up just fine. However I didn’t what to rule out the likelihood of me doing something else wrong in the process.

The other option is, should I be doing the customizations on each individual dashboard and then putting them together after that? The problem is, I don’t know how to control the customizations on the child dashboards if I do that.

I don’t think I have the skill level to properly answer your question but I can tell you that if I was doing it, I’d probably leave the dashboard alone, export it as an assembly then customize that.

Ok, well I’ll get it figured out somehow. Probably some trial and error. I’m going to get the print button from the parent dashboard assembly working first (even though that’s the biggest, hardest report) just because the controls show up the right way. And then I’ll work in the child dashboards.

So many new things to learn

1 Like

Brandon
You should make 1 dashboard and deploy that as an assembly, the customize the assembly. Customizing on top of publish / subscribe dashboards (even as assemblies) doesn’t work very well… (assuming I understood what you are doing)

The only reason I’m doing it this way is to get the tabs to show up the way that I want them to. There is no sheet wizard in dashboard creation. If I put it all into one dashboard I can’t get the photo viewers (url view) to show where they are supposed to and I can’t have the two mid level tabs with tabs below them work as I want. I wish they had a sheet wizard in the dashboard creation so you could manage that better. They have it all over in E-10 so I don’t understand why it’s so hard to set up.

Is there a way to move views that are already created to different tabs in a customization?

You can move them in code. Just get a hold of the control and change its parent .

José C Gomez
Senior Software Engineer

So to do that, I should make the dashboard with all of the info that I need (even though the screen will be pretty crowded) and then in the customization, I need to create the blank sheets with the sheet wizard right? Once I have those in place, then I should be able to move the grids, trackers and URL views to the views for those tabs? Do I set the parents in the custom XML editor? Or is that in the script editor somewhere? Everything that I’ve done so far has been tied to an event, so setting up views is new to me. (Edit: I just looked and there is an event type load, probably would use that huh?) (Edit #2 it looks like this is the code to move things around parentelement.controls.add(childelement) ? I found that here E9: Moving an Epicor tab or groupbox - Yahoo Archive - Epicor User Help Forum)

Is this info in the customization guide? I can look it up in there too if you can give me a hint of what section it would be in.