Getting the where items formatted properly can be a challenge. I start with no where item to make sure I am getting something. Then with a single where item and see if I get a result. And then build from there. I usually use the BL tester to get the where values correct, then move it over to the code.
Jim K
Jim K
--- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@...> wrote:
>
> Jim,
>
> Interesting. I tried the code (struggling with C#)
>
> I get an empty result table. Does have headers!
>
> Here is what I have:
>
> String startDate = epiDateTimeEditorC1.Value.ToString();
> String endDate = epiDateTimeEditorC2.Value.ToString();
> String BaqID = "DTSF-FilteredWeeklyTimeExport";
> QueryDesignDataSet ds;
>
> String pcQueryID = BaqID;
> String pcTable = "LaborDtl";
> String pcField = "PayrollDate";
> String pcCondition = "=";
> Boolean pbIsConst = true;
> String pcValue = String.Empty;
> String pcToTable = String.Empty;
> String pcToField = String.Empty;
> String pcLeftParentheses = String.Empty;
> String pcRightParentheses = String.Empty;
> String pcAndOr = String.Empty;
> Boolean pbNeg = false;
> DynamicQueryAdapter adDynamic = new DynamicQueryAdapter(UD35Form);
> adDynamic.BOConnect();
> adDynamic.GetByID(BaqID);
> ds = adDynamic.QueryDesignData;
>
> pcValue = startDate;
> pcAndOr = "";
> pcCondition = ">=";
> adDynamic.AddWhereItem(ds, pcQueryID, pcTable, pcField, pcCondition, pbIsConst, pcValue, pcToTable, pcToField, pcLeftParentheses, pcRightParentheses, pcAndOr,pbNeg);
>
> pcValue = endDate;
> pcAndOr = "And"; //String.Empty;
> pcCondition = "<=";
> adDynamic.AddWhereItem(ds, pcQueryID, pcTable, pcField, pcCondition, pbIsConst, pcValue, pcToTable, pcToField, pcLeftParentheses, pcRightParentheses, pcAndOr,pbNeg);
>
> adDynamic.Execute(ds);
>
> DataSet Dset = adDynamic.QueryResults;
> epiUltraGridC1.DataSource = Dset;
>
> Jeff Sanders
>
>
> --- In vantage@yahoogroups.com, "jckinneman" <jckinneman@> wrote:
> >
> >
> >
> > Since you are on 9 this should accomplish the same end result. For 9 I recommend using C#. Epicor and the tools are starting to favor C#.
> >
> > Converting this to VB is fairly simple, you might be able to run it through a C# to VB converter that you can find via Google.
> >
> > In this example I am searching for a BOL Number, you can use any table field that is on the BAQ not just the display fields, in your case you can search on any field that is in labordtl,
> >
> > String BaqID = "your-baq-name-goes-here";
> > QueryDesignDataSet ds;
> > // this is used with the whereitem call to adjust the selection criteria
> >
> > String pcQueryID = BaqID;
> > String pcTable = "BOLHead";
> > String pcField = "BOLNum";
> > String pcCondition = "=";
> > Boolean pbIsConst = true;
> > String pcValue = String.Empty;
> > String pcToTable = String.Empty;
> > String pcToField = String.Empty;
> > String pcLeftParentheses = String.Empty;
> > String pcRightParentheses = String.Empty;
> > String pcAndOr = String.Empty;
> > Boolean pbNeg = false;
> > // If selection criteria is needed we need
> > // to load the query and then add selection criteria before running it instead
> > // of directly executing it.
> >
> > DynamicQueryAdapter adDynamic = new DynamicQueryAdapter(BAQReportForm);
> > adDynamic.BOConnect();
> > // if BAQ needed no selection criteria you could run it directly
> > //adDynamic.ExecuteByID(BaqID);
> > // to add selection criteria first have to retrieve it
> > // BaqID would have your BAQ Name in it
> > adDynamic.GetByID(BaqID);
> > ds = adDynamic.QueryDesignData;
> > pcValue = "23" // bolnum
> >
> > adDynamic.AddWhereItem(ds, pcQueryID, pcTable, pcField, pcCondition, pbIsConst, pcValue, pcToTable, pcToField, pcLeftParentheses, pcRightParentheses, pcAndOr, pbNeg);
> > // repeat the above command adding all the criteria you need. If needed you can put in parentheses, AND's and OR's
> > // this is the BO you are using when you are designing the BAQ so you can pretty much do anything you can do in the BAQ Designer.
> > adDynamic.Execute(ds);
> > // adDynamic.QueryResults now has the results of the BAQ, it has all the display fields you put on the BAQ
> > // there only one table.
> >
> > adDynamic.QueryResults.Tables[0].WriteXml("BAQ Report DataSet.xml",XmlWriteMode.WriteSchema);
> >
> > Happy to answer any questions,
> >
> > Jim Kinneman
> > Senior Consultant
> > Encompass Solutions, Inc
> >
> >
> > --- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@> wrote:
> > >
> > > 9.05.600C
> > >
> > > I've searched everywhere I know to search for answers to this to no avail. If I figure this out I will post it in the files section for this group.
> > >
> > > I am trying to send two parameters to a BAQ to filter the results using the ExecuteByIDParametrized method of the Dynamic Query Adapter. I want to get the labordtl records for the last payroll period into correct format to export to our payroll system. (Long story)
> > >
> > > I have a BAQ with two parameters. FirstDate and LastDate. You can see my screen shot of the BAQ Query Phrase in a zip file I uploaded in the Files section:
> > > "http://tech.groups.yahoo.com/group/vantage/files/_Misc/905-600C_BAQScreenShots.zip "
> > >
> > > I also included three screenshots of the BL tester showing the Execution Parameters and the results. It works.
> > >
> > > I am having problems getting the execution parameters into the QueryExecutionDataSet (var=execSet). I can't find any documentation on this. Anyone have a clue? I've tried guessing without success. Where would I find documentation?
> > >
> > > Thanks in advance,
> > > Jeff Sanders
> > >
> >
>