Mine was based in project entry and they wanted a fast way to attach quotes. I made a BAQ view within project entry of available quote lines, made a filtering field similar to a dashboard, the user could select multiple rows, even from different quotes and click a Add. This would run through the recselected and using an adapter attach the selected, then refresh the baq view to remove the used quote lines as well as the project to show the newly attached quotes.
So my suggestion, if you feel like doing it, would be to build this into the shipping form and itās up to the user to make a new pack or use an existing one and your script would use what ever is on screen.
Thanks Dan, That would be good to learn. I havenāt done a BAQ view before, so some example code on that would be very much appreciated.
So basically, I could have the BAQ view, and end up with basically one way list picker if if I handled the refreshing the right way (So it refreshes after the lines are added)? Then, as long and I have the filters set correctly, they shouldnāt be able to add anything erroneously?
First youāll want to reference the Dynamic Query Adapter.
Create your grid.
Initialize your script in InitializeCustomCode using āLoadProjects();ā for this example.
Modify this script that I made comments on:
private void LoadProjects() {
DynamicQueryAdapter baqAdapter = new DynamicQueryAdapter(oTrans); //Call Adapter
baqAdapter.BOConnect();
baqAdapter.ExecuteByID(āScheduleProjectsā); //BAQ NAME
EpiDataView edvProjects = new EpiDataView();
edvProjects.dataView = new DataView(baqAdapter.QueryResults.Tables["Results"]); //Add Results to EpiDataView
foreach(DataColumn dc in edvProjects.dataView.Table.Columns) { //Make read only
dc.ExtendedProperties["ReadOnly"] = true;
dc.ExtendedProperties["Like"] = dc.ColumnName.ToString(); //Column Names
}
if((oTrans.EpiDataViews.ContainsKey("ProjectsView") == false)) {
oTrans.Add("ProjectsView", edvProjects); //Add view
}
baqAdapter.Dispose();
}
and then save/close, reload the form and bind the grid to the āProjectsViewā in the EpiBinding property of the grid.
I didnāt like my answer to you earlier. Iāve been trying to figure out a quick/easy way to bind a grid and refresh it for my own projects. I think Iāve figured out a low cost way and wanted to update what I told you earlier.
Add Reference DynamicQueryAdapter.
Then use the script:
private void LoadProjects() {
DynamicQueryAdapter baqAdapter = new DynamicQueryAdapter(oTrans);
baqAdapter.BOConnect();
baqAdapter.ExecuteByID("ScheduleProjects"); //BAQ Name
grdProjectSelect.DataSource = baqAdapter.QueryResults.Tables["Results"]; //Load DataTable to grid using just grid name.(dont bind using properties)
baqAdapter.Dispose(); }
drop āLoadProjects();ā into your initialize script.
Call LoadProjects(); when ever you need to refresh.
ok, Thatās basically what I have going on. Iāve been using this video again to get the BAQ into the grid. Iām pretty sure itās basically what you have there, you just donāt have any parameters.
So I end up with this, which I put into a View Notification event. Whenever you load in a supplier, the lines for that supplier show up in the line picker grid.
The problem that I am having now, is I have stuff in the BAQ that I need for filtering purposes, but I donāt want to show up in the grid for the end user. Since the grid is populated dynamically, I donāt have any control over it.
So I think I might have to look at your first answer because I need an established data view in order to control the grid the way I need. (I think???)
Another thought is the bury the current top level with the required information in a subquery and only show the fields I want visible in the top level. That could probably work ok.
They are calculated, so yeah⦠You can filter on the table without them being visible, but I have some calculated fields that determines whether that line should be available for them to pick or not. For that I use the SubQuery Criteria.
I create a .csv from the selected rows in a grid. The user selects the rows that they want to copy, press a button which runs the code that uses streamwriter to create the .csv file. In the code I decide what fields are sent to the .csv and in what order. and where the file is saved to. This same code can be used to copy it to the clipboard only. That code is at the bottom and its commented out.
using System.IO;
using System.Collections;
using System.Collections.Generic;
using Infragistics.Win.UltraWinGrid;
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
Infragistics.Win.UltraWinGrid.SelectedRowsCollection selectedRows;
using (StreamWriter lf = new StreamWriter(@ā\C\hold\VLM.csvā, false)) //csv file name and location
{
EpiUltraGrid eugMySelections = (EpiUltraGrid)csm.GetNativeControlReference("b631eaf6-a370-4858-b1f6-92854038dd4c"); //GUID of the grid
selectedRows = eugMySelections.Selected.Rows;
if ( selectedRows.Count < -1 ) // Get the selected rows.
return;
System.Text.StringBuilder sb = new System.Text.StringBuilder( );//builds string for clipboard
for ( int i = 0; i < selectedRows.Count; i++ )
{
Infragistics.Win.UltraWinGrid.UltraGridRow row;
row = selectedRows[i];
//the following sends it to the csv file
lf.Write(row.Cells[ "OrderNum" ].Text );
lf.Write(",");
lf.Write( row.Cells["OrderLine"].Text );
lf.Write(",");
lf.Write( row.Cells[ "ShortChar06" ].Text ); // EDP
lf.Write(",");
lf.Write( row.Cells["Quantity"].Text );
lf.Write(",");
lf.Write(row.Cells[ "FromBinNum" ].Text );
lf.Write(",");
lf.Write( row.Cells["OrderLine"].Text );
lf.Write(",");
lf.Write("\""); // this send message that this is the end of the order
lf.Write("\r\n"); //this send a line break/return
//sb.Append( row.Cells[ "PartNum" ].Text ); //this sends it to the clipboard
//sb.Append( "," );
//sb.Append( "\r\n" );//this appends to the end of the clipboard the next line from the grid
}
MessageBox.Show("Exported");
//System.Windows.Forms.Clipboard.SetDataObject( sb.ToString( ) );// Copy the text to the clipboard.
}
}