Follow Up RE: Exporting BAQ results to a CSV file

Good Day:

If you make it a report that goes to the Sys-Monitor, then >> run
report >> do preview in Sys.Monitor >> in upper left corner, do Export.

.csv is not listed, but other text types are. There is also a "....
Data only" that might work. It 'flatens' the output.



Leonard C. Hartka, IT Director\ERP Manager
Sun Automation Group
66 Loveton Circle
Sparks, Md. 21152
410-329-3560 ext. 120
410-329-3564 FAX
443-255-7192 Work Cell
len.hartka@...

Baq-text baq-txt

________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Len Hartka
Sent: Friday, April 06, 2012 6:40 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Re: Exporting BAQ results to a CSV file




Good Day:

Run the BAQ >> Right click in the grid- pick "Copy to Excell" >> do
"Save as" and change the file type at the bottom to csv.

Excell has a 64,000 record limit unless it is Excell 2010.

I was not sure how automated you wanted it.


Leonard C. Hartka, IT Director\ERP Manager
Sun Automation Group
66 Loveton Circle
Sparks, Md. 21152
410-329-3560 ext. 120
410-329-3564 FAX
443-255-7192 Work Cell
len.hartka@... <mailto:len.hartka%40sunautomation.com>

________________________________

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf
Of villalob
Sent: Friday, April 06, 2012 11:34 AM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: [Vantage] Re: Exporting BAQ results to a CSV file

Here is a working example of exporting to a csv file

Private Sub CallDynamicQueryAdapterExportMethod()
Try
' Declare and Initialize EpiDataView Variables
' Declare and create an instance of the Adapter.
Dim adapterDynamicQuery As DynamicQueryAdapter = New
DynamicQueryAdapter(Me.oTrans)
adapterDynamicQuery.BOConnect

' Declare and Initialize Variables
dim strBAQName as string
Dim result As Boolean
Dim pbSuccess As System.Boolean

strBAQName = "EPIC03-jdvTest9"
' Get the ID of BAQ that you wish to work with
adapterDynamicQuery.GetQueryByID(strBAQName)

result = adapterDynamicQuery.Export(adapterDynamicQuery.RuntimeQuery,
"c:\temp\test", "csv", ",", false, pbSuccess)
' Cleanup Adapter Reference
adapterDynamicQuery.Dispose

Catch ex As System.Exception
ExceptionBox.Show(ex)
End Try
End Sub

--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com> ,
"jeffery_p_sanders" <jps@...> wrote:
>
> Never mind. I found it:
>
> Dim sw As New System.IO.StreamWriter(sOutputFile, False)
>
> Jeff Sanders
>
>
> --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com> ,
"jeffery_p_sanders" <jps@> wrote:
> >
> > What code do I use in place of the StreamWriter? (not recognized)
> >
> > Jeff Sanders
> >
> >
> > --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com> ,
"jckinneman" <jckinneman@> wrote:
> > >
> > > Since some of these BO don't get a lot of use I have come across
some that just plain don't work or I don't/won't/haven't taken the time
to figure out how they work. In these cases I fall back on that Epicor
objects are all based on standard .net objects and standard
tools/approaches usually work. Since plagiarism (not in its true sense
of the word) is the best form of programming, here is a link that shows
how to export a dataset to csv.
http://geekswithblogs.net/cubeberg/articles/78814.aspx
> > >
> > > --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com>
, "jeffery_p_sanders" <jps@> wrote:
> > > >
> > > > I thought this would be the easy part. I was wrong.
> > > >
> > > > As you can see in the code below, I am trying to export the
BAQ's QueryResults to a CSV file. I get the error "Query not found". Any
ideas?
> > > >
> > > > Top part of code is there for reference...The export is between
the asterisks.
> > > >
> > > > Dim startDate as Date = epiDateTimeEditorC1.Value
> > > > Dim endDate as Date = epiDateTimeEditorC2.Value
> > > > Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
> > > > Dim DQadpt as DynamicqueryAdapter = New
DynamicQueryAdapter(UD35Form)
> > > > DQadpt.BOConnect()
> > > > Dim topNRecords as int32 = 100000
> > > > Dim hasMoreRecords as boolean = True
> > > > Dim resultFieldList as string = ""
> > > > Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet =
DQadpt.GetQueryExecutionParametersByID(baqID)
> > > > Dim targetRow as DataRow
> > > > Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
> > > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > > targetRow("ParameterName") = "FirstDate"
> > > > targetRow("ParameterValue") = startDate
> > > > targetRow("ValueType") = "Date"
> > > > targetRow("IsEmpty") = False
> > > > targetRow("RowIdent") = "A"
> > > > tbl.Rows.Add(targetRow)
> > > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > > targetRow("ParameterName") = "LastDate"
> > > > targetRow("ParameterValue") = endDate
> > > > targetRow("ValueType") = "Date"
> > > > targetRow("IsEmpty") = False
> > > > targetRow("RowIdent") = "A"
> > > > tbl.Rows.Add(targetRow)
> > > >
> > > > DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList,
topNRecords, hasMoreRecords)
> > > >
> > > > 'All code above works
> > > >
> > > > '*****************************************
> > > >
> > > > 'Export code
> > > > 'The records I want to export are now found in
DQadpt.QueryResults
> > > >
> > > > dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
> > > > dim pcFile as string = "C:\Test.CSV"
> > > > dim pcFileType as string = "CSV"
> > > > dim pcTextDelim as string = ","
> > > > dim pbOutputLabels as boolean = False
> > > > dim pbSuccess as boolean
> > > >
> > > > Dim fileExported As Boolean = DQadpt.Export(ds, pcFile,
pcFileType, pcTextDelim, pbOutputLabels, pbSuccess)
> > > >
> > > > '*********************************************
> > > > DQadpt.Dispose()
> > > >
> > > >
> > > > Jeff Sanders
> > > >
> > >
> >
>

This e-mail and any attachments may contain proprietary and/or
confidential information. If you are not the intended recipient, please
notify the sender immediately by reply e-mail or at 410-472-2900 and
then delete the message without using, disseminating, or copying this
message or any portion thereof. With e-mail communications you are urged
to protect against viruses.

[Non-text portions of this message have been removed]






This e-mail and any attachments may contain proprietary and/or confidential information. If you are not the intended recipient, please notify the sender immediately by reply e-mail or at 410-472-2900 and then delete the message without using, disseminating, or copying this message or any portion thereof. With e-mail communications you are urged to protect against viruses.


[Non-text portions of this message have been removed]
I thought this would be the easy part. I was wrong.

As you can see in the code below, I am trying to export the BAQ's QueryResults to a CSV file. I get the error "Query not found". Any ideas?

Top part of code is there for reference...The export is between the asterisks.

Dim startDate as Date = epiDateTimeEditorC1.Value
Dim endDate as Date = epiDateTimeEditorC2.Value
Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
Dim DQadpt as DynamicqueryAdapter = New DynamicQueryAdapter(UD35Form)
DQadpt.BOConnect()
Dim topNRecords as int32 = 100000
Dim hasMoreRecords as boolean = True
Dim resultFieldList as string = ""
Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet = DQadpt.GetQueryExecutionParametersByID(baqID)
Dim targetRow as DataRow
Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
targetRow = execSet.Tables("ExecutionParameter").NewRow()
targetRow("ParameterName") = "FirstDate"
targetRow("ParameterValue") = startDate
targetRow("ValueType") = "Date"
targetRow("IsEmpty") = False
targetRow("RowIdent") = "A"
tbl.Rows.Add(targetRow)
targetRow = execSet.Tables("ExecutionParameter").NewRow()
targetRow("ParameterName") = "LastDate"
targetRow("ParameterValue") = endDate
targetRow("ValueType") = "Date"
targetRow("IsEmpty") = False
targetRow("RowIdent") = "A"
tbl.Rows.Add(targetRow)

DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList, topNRecords, hasMoreRecords)

'All code above works

'*****************************************

'Export code
'The records I want to export are now found in DQadpt.QueryResults

dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
dim pcFile as string = "C:\Test.CSV"
dim pcFileType as string = "CSV"
dim pcTextDelim as string = ","
dim pbOutputLabels as boolean = False
dim pbSuccess as boolean

Dim fileExported As Boolean = DQadpt.Export(ds, pcFile, pcFileType, pcTextDelim, pbOutputLabels, pbSuccess)

'*********************************************
DQadpt.Dispose()


Jeff Sanders
Since some of these BO don't get a lot of use I have come across some that just plain don't work or I don't/won't/haven't taken the time to figure out how they work. In these cases I fall back on that Epicor objects are all based on standard .net objects and standard tools/approaches usually work. Since plagiarism (not in its true sense of the word) is the best form of programming, here is a link that shows how to export a dataset to csv. http://geekswithblogs.net/cubeberg/articles/78814.aspx

--- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@...> wrote:
>
> I thought this would be the easy part. I was wrong.
>
> As you can see in the code below, I am trying to export the BAQ's QueryResults to a CSV file. I get the error "Query not found". Any ideas?
>
> Top part of code is there for reference...The export is between the asterisks.
>
> Dim startDate as Date = epiDateTimeEditorC1.Value
> Dim endDate as Date = epiDateTimeEditorC2.Value
> Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
> Dim DQadpt as DynamicqueryAdapter = New DynamicQueryAdapter(UD35Form)
> DQadpt.BOConnect()
> Dim topNRecords as int32 = 100000
> Dim hasMoreRecords as boolean = True
> Dim resultFieldList as string = ""
> Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet = DQadpt.GetQueryExecutionParametersByID(baqID)
> Dim targetRow as DataRow
> Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
> targetRow = execSet.Tables("ExecutionParameter").NewRow()
> targetRow("ParameterName") = "FirstDate"
> targetRow("ParameterValue") = startDate
> targetRow("ValueType") = "Date"
> targetRow("IsEmpty") = False
> targetRow("RowIdent") = "A"
> tbl.Rows.Add(targetRow)
> targetRow = execSet.Tables("ExecutionParameter").NewRow()
> targetRow("ParameterName") = "LastDate"
> targetRow("ParameterValue") = endDate
> targetRow("ValueType") = "Date"
> targetRow("IsEmpty") = False
> targetRow("RowIdent") = "A"
> tbl.Rows.Add(targetRow)
>
> DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList, topNRecords, hasMoreRecords)
>
> 'All code above works
>
> '*****************************************
>
> 'Export code
> 'The records I want to export are now found in DQadpt.QueryResults
>
> dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
> dim pcFile as string = "C:\Test.CSV"
> dim pcFileType as string = "CSV"
> dim pcTextDelim as string = ","
> dim pbOutputLabels as boolean = False
> dim pbSuccess as boolean
>
> Dim fileExported As Boolean = DQadpt.Export(ds, pcFile, pcFileType, pcTextDelim, pbOutputLabels, pbSuccess)
>
> '*********************************************
> DQadpt.Dispose()
>
>
> Jeff Sanders
>
What code do I use in place of the StreamWriter? (not recognized)

Jeff Sanders


--- In vantage@yahoogroups.com, "jckinneman" <jckinneman@...> wrote:
>
> Since some of these BO don't get a lot of use I have come across some that just plain don't work or I don't/won't/haven't taken the time to figure out how they work. In these cases I fall back on that Epicor objects are all based on standard .net objects and standard tools/approaches usually work. Since plagiarism (not in its true sense of the word) is the best form of programming, here is a link that shows how to export a dataset to csv. http://geekswithblogs.net/cubeberg/articles/78814.aspx
>
> --- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@> wrote:
> >
> > I thought this would be the easy part. I was wrong.
> >
> > As you can see in the code below, I am trying to export the BAQ's QueryResults to a CSV file. I get the error "Query not found". Any ideas?
> >
> > Top part of code is there for reference...The export is between the asterisks.
> >
> > Dim startDate as Date = epiDateTimeEditorC1.Value
> > Dim endDate as Date = epiDateTimeEditorC2.Value
> > Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
> > Dim DQadpt as DynamicqueryAdapter = New DynamicQueryAdapter(UD35Form)
> > DQadpt.BOConnect()
> > Dim topNRecords as int32 = 100000
> > Dim hasMoreRecords as boolean = True
> > Dim resultFieldList as string = ""
> > Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet = DQadpt.GetQueryExecutionParametersByID(baqID)
> > Dim targetRow as DataRow
> > Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
> > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > targetRow("ParameterName") = "FirstDate"
> > targetRow("ParameterValue") = startDate
> > targetRow("ValueType") = "Date"
> > targetRow("IsEmpty") = False
> > targetRow("RowIdent") = "A"
> > tbl.Rows.Add(targetRow)
> > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > targetRow("ParameterName") = "LastDate"
> > targetRow("ParameterValue") = endDate
> > targetRow("ValueType") = "Date"
> > targetRow("IsEmpty") = False
> > targetRow("RowIdent") = "A"
> > tbl.Rows.Add(targetRow)
> >
> > DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList, topNRecords, hasMoreRecords)
> >
> > 'All code above works
> >
> > '*****************************************
> >
> > 'Export code
> > 'The records I want to export are now found in DQadpt.QueryResults
> >
> > dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
> > dim pcFile as string = "C:\Test.CSV"
> > dim pcFileType as string = "CSV"
> > dim pcTextDelim as string = ","
> > dim pbOutputLabels as boolean = False
> > dim pbSuccess as boolean
> >
> > Dim fileExported As Boolean = DQadpt.Export(ds, pcFile, pcFileType, pcTextDelim, pbOutputLabels, pbSuccess)
> >
> > '*********************************************
> > DQadpt.Dispose()
> >
> >
> > Jeff Sanders
> >
>
Can you add an "Imports System.IO" at the top of the file?

Otherwise you can say: System.IO.StreamWriter writer = new
System.IO.StreamWriter

The Imports statements just add those namespaces to the compiler's
search path to save you some typing.

-bws

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of jeffery_p_sanders
Sent: Friday, August 27, 2010 11:58 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Exporting BAQ results to a CSV file

What code do I use in place of the StreamWriter? (not recognized)

Jeff Sanders


--- In vantage@yahoogroups.com, "jckinneman" <jckinneman@...> wrote:
>
> Since some of these BO don't get a lot of use I have come across some
that just plain don't work or I don't/won't/haven't taken the time to
figure out how they work. In these cases I fall back on that Epicor
objects are all based on standard .net objects and standard
tools/approaches usually work. Since plagiarism (not in its true sense
of the word) is the best form of programming, here is a link that shows
how to export a dataset to csv.
http://geekswithblogs.net/cubeberg/articles/78814.aspx
>
> --- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@> wrote:
> >
> > I thought this would be the easy part. I was wrong.
> >
> > As you can see in the code below, I am trying to export the BAQ's
QueryResults to a CSV file. I get the error "Query not found". Any
ideas?
> >
> > Top part of code is there for reference...The export is between the
asterisks.
> >
> > Dim startDate as Date = epiDateTimeEditorC1.Value
> > Dim endDate as Date = epiDateTimeEditorC2.Value
> > Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
> > Dim DQadpt as DynamicqueryAdapter = New
DynamicQueryAdapter(UD35Form)
> > DQadpt.BOConnect()
> > Dim topNRecords as int32 = 100000
> > Dim hasMoreRecords as boolean = True
> > Dim resultFieldList as string = ""
> > Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet =
DQadpt.GetQueryExecutionParametersByID(baqID)
> > Dim targetRow as DataRow
> > Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
> > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > targetRow("ParameterName") = "FirstDate"
> > targetRow("ParameterValue") = startDate
> > targetRow("ValueType") = "Date"
> > targetRow("IsEmpty") = False
> > targetRow("RowIdent") = "A"
> > tbl.Rows.Add(targetRow)
> > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > targetRow("ParameterName") = "LastDate"
> > targetRow("ParameterValue") = endDate
> > targetRow("ValueType") = "Date"
> > targetRow("IsEmpty") = False
> > targetRow("RowIdent") = "A"
> > tbl.Rows.Add(targetRow)
> >
> > DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList,
topNRecords, hasMoreRecords)
> >
> > 'All code above works
> >
> > '*****************************************
> >
> > 'Export code
> > 'The records I want to export are now found in DQadpt.QueryResults
> >
> > dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
> > dim pcFile as string = "C:\Test.CSV"
> > dim pcFileType as string = "CSV"
> > dim pcTextDelim as string = ","
> > dim pbOutputLabels as boolean = False
> > dim pbSuccess as boolean
> >
> > Dim fileExported As Boolean = DQadpt.Export(ds, pcFile, pcFileType,
pcTextDelim, pbOutputLabels, pbSuccess)
> >
> > '*********************************************
> > DQadpt.Dispose()
> >
> >
> > Jeff Sanders
> >
>




------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder
and Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
Never mind. I found it:

Dim sw As New System.IO.StreamWriter(sOutputFile, False)

Jeff Sanders


--- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@...> wrote:
>
> What code do I use in place of the StreamWriter? (not recognized)
>
> Jeff Sanders
>
>
> --- In vantage@yahoogroups.com, "jckinneman" <jckinneman@> wrote:
> >
> > Since some of these BO don't get a lot of use I have come across some that just plain don't work or I don't/won't/haven't taken the time to figure out how they work. In these cases I fall back on that Epicor objects are all based on standard .net objects and standard tools/approaches usually work. Since plagiarism (not in its true sense of the word) is the best form of programming, here is a link that shows how to export a dataset to csv. http://geekswithblogs.net/cubeberg/articles/78814.aspx
> >
> > --- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@> wrote:
> > >
> > > I thought this would be the easy part. I was wrong.
> > >
> > > As you can see in the code below, I am trying to export the BAQ's QueryResults to a CSV file. I get the error "Query not found". Any ideas?
> > >
> > > Top part of code is there for reference...The export is between the asterisks.
> > >
> > > Dim startDate as Date = epiDateTimeEditorC1.Value
> > > Dim endDate as Date = epiDateTimeEditorC2.Value
> > > Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
> > > Dim DQadpt as DynamicqueryAdapter = New DynamicQueryAdapter(UD35Form)
> > > DQadpt.BOConnect()
> > > Dim topNRecords as int32 = 100000
> > > Dim hasMoreRecords as boolean = True
> > > Dim resultFieldList as string = ""
> > > Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet = DQadpt.GetQueryExecutionParametersByID(baqID)
> > > Dim targetRow as DataRow
> > > Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
> > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > targetRow("ParameterName") = "FirstDate"
> > > targetRow("ParameterValue") = startDate
> > > targetRow("ValueType") = "Date"
> > > targetRow("IsEmpty") = False
> > > targetRow("RowIdent") = "A"
> > > tbl.Rows.Add(targetRow)
> > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > targetRow("ParameterName") = "LastDate"
> > > targetRow("ParameterValue") = endDate
> > > targetRow("ValueType") = "Date"
> > > targetRow("IsEmpty") = False
> > > targetRow("RowIdent") = "A"
> > > tbl.Rows.Add(targetRow)
> > >
> > > DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList, topNRecords, hasMoreRecords)
> > >
> > > 'All code above works
> > >
> > > '*****************************************
> > >
> > > 'Export code
> > > 'The records I want to export are now found in DQadpt.QueryResults
> > >
> > > dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
> > > dim pcFile as string = "C:\Test.CSV"
> > > dim pcFileType as string = "CSV"
> > > dim pcTextDelim as string = ","
> > > dim pbOutputLabels as boolean = False
> > > dim pbSuccess as boolean
> > >
> > > Dim fileExported As Boolean = DQadpt.Export(ds, pcFile, pcFileType, pcTextDelim, pbOutputLabels, pbSuccess)
> > >
> > > '*********************************************
> > > DQadpt.Dispose()
> > >
> > >
> > > Jeff Sanders
> > >
> >
>
Can I suggest looking at the Business Activity Query Export Program under Utilities in the System Management area. At least in 8.03.4xx, this exports a BAQ to a CSV with column headings if you want.


Carl Heeder
281-797-2200

[Non-text portions of this message have been removed]
Here is a working example of exporting to a csv file


Private Sub CallDynamicQueryAdapterExportMethod()
Try
' Declare and Initialize EpiDataView Variables
' Declare and create an instance of the Adapter.
Dim adapterDynamicQuery As DynamicQueryAdapter = New DynamicQueryAdapter(Me.oTrans)
adapterDynamicQuery.BOConnect

' Declare and Initialize Variables
dim strBAQName as string
Dim result As Boolean
Dim pbSuccess As System.Boolean

strBAQName = "EPIC03-jdvTest9"
' Get the ID of BAQ that you wish to work with
adapterDynamicQuery.GetQueryByID(strBAQName)

result = adapterDynamicQuery.Export(adapterDynamicQuery.RuntimeQuery, "c:\temp\test", "csv", ",", false, pbSuccess)
' Cleanup Adapter Reference
adapterDynamicQuery.Dispose

Catch ex As System.Exception
ExceptionBox.Show(ex)
End Try
End Sub

--- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@...> wrote:
>
> Never mind. I found it:
>
> Dim sw As New System.IO.StreamWriter(sOutputFile, False)
>
> Jeff Sanders
>
>
> --- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@> wrote:
> >
> > What code do I use in place of the StreamWriter? (not recognized)
> >
> > Jeff Sanders
> >
> >
> > --- In vantage@yahoogroups.com, "jckinneman" <jckinneman@> wrote:
> > >
> > > Since some of these BO don't get a lot of use I have come across some that just plain don't work or I don't/won't/haven't taken the time to figure out how they work. In these cases I fall back on that Epicor objects are all based on standard .net objects and standard tools/approaches usually work. Since plagiarism (not in its true sense of the word) is the best form of programming, here is a link that shows how to export a dataset to csv. http://geekswithblogs.net/cubeberg/articles/78814.aspx
> > >
> > > --- In vantage@yahoogroups.com, "jeffery_p_sanders" <jps@> wrote:
> > > >
> > > > I thought this would be the easy part. I was wrong.
> > > >
> > > > As you can see in the code below, I am trying to export the BAQ's QueryResults to a CSV file. I get the error "Query not found". Any ideas?
> > > >
> > > > Top part of code is there for reference...The export is between the asterisks.
> > > >
> > > > Dim startDate as Date = epiDateTimeEditorC1.Value
> > > > Dim endDate as Date = epiDateTimeEditorC2.Value
> > > > Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
> > > > Dim DQadpt as DynamicqueryAdapter = New DynamicQueryAdapter(UD35Form)
> > > > DQadpt.BOConnect()
> > > > Dim topNRecords as int32 = 100000
> > > > Dim hasMoreRecords as boolean = True
> > > > Dim resultFieldList as string = ""
> > > > Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet = DQadpt.GetQueryExecutionParametersByID(baqID)
> > > > Dim targetRow as DataRow
> > > > Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
> > > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > > targetRow("ParameterName") = "FirstDate"
> > > > targetRow("ParameterValue") = startDate
> > > > targetRow("ValueType") = "Date"
> > > > targetRow("IsEmpty") = False
> > > > targetRow("RowIdent") = "A"
> > > > tbl.Rows.Add(targetRow)
> > > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > > targetRow("ParameterName") = "LastDate"
> > > > targetRow("ParameterValue") = endDate
> > > > targetRow("ValueType") = "Date"
> > > > targetRow("IsEmpty") = False
> > > > targetRow("RowIdent") = "A"
> > > > tbl.Rows.Add(targetRow)
> > > >
> > > > DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList, topNRecords, hasMoreRecords)
> > > >
> > > > 'All code above works
> > > >
> > > > '*****************************************
> > > >
> > > > 'Export code
> > > > 'The records I want to export are now found in DQadpt.QueryResults
> > > >
> > > > dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
> > > > dim pcFile as string = "C:\Test.CSV"
> > > > dim pcFileType as string = "CSV"
> > > > dim pcTextDelim as string = ","
> > > > dim pbOutputLabels as boolean = False
> > > > dim pbSuccess as boolean
> > > >
> > > > Dim fileExported As Boolean = DQadpt.Export(ds, pcFile, pcFileType, pcTextDelim, pbOutputLabels, pbSuccess)
> > > >
> > > > '*********************************************
> > > > DQadpt.Dispose()
> > > >
> > > >
> > > > Jeff Sanders
> > > >
> > >
> >
>
Good Day:

Run the BAQ >> Right click in the grid- pick "Copy to Excell" >> do
"Save as" and change the file type at the bottom to csv.

Excell has a 64,000 record limit unless it is Excell 2010.

I was not sure how automated you wanted it.


Leonard C. Hartka, IT Director\ERP Manager
Sun Automation Group
66 Loveton Circle
Sparks, Md. 21152
410-329-3560 ext. 120
410-329-3564 FAX
443-255-7192 Work Cell
len.hartka@...

________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of villalob
Sent: Friday, April 06, 2012 11:34 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Exporting BAQ results to a CSV file






Here is a working example of exporting to a csv file

Private Sub CallDynamicQueryAdapterExportMethod()
Try
' Declare and Initialize EpiDataView Variables
' Declare and create an instance of the Adapter.
Dim adapterDynamicQuery As DynamicQueryAdapter = New
DynamicQueryAdapter(Me.oTrans)
adapterDynamicQuery.BOConnect

' Declare and Initialize Variables
dim strBAQName as string
Dim result As Boolean
Dim pbSuccess As System.Boolean

strBAQName = "EPIC03-jdvTest9"
' Get the ID of BAQ that you wish to work with
adapterDynamicQuery.GetQueryByID(strBAQName)

result = adapterDynamicQuery.Export(adapterDynamicQuery.RuntimeQuery,
"c:\temp\test", "csv", ",", false, pbSuccess)
' Cleanup Adapter Reference
adapterDynamicQuery.Dispose

Catch ex As System.Exception
ExceptionBox.Show(ex)
End Try
End Sub

--- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"jeffery_p_sanders" <jps@...> wrote:
>
> Never mind. I found it:
>
> Dim sw As New System.IO.StreamWriter(sOutputFile, False)
>
> Jeff Sanders
>
>
> --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"jeffery_p_sanders" <jps@> wrote:
> >
> > What code do I use in place of the StreamWriter? (not recognized)
> >
> > Jeff Sanders
> >
> >
> > --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ,
"jckinneman" <jckinneman@> wrote:
> > >
> > > Since some of these BO don't get a lot of use I have come across
some that just plain don't work or I don't/won't/haven't taken the time
to figure out how they work. In these cases I fall back on that Epicor
objects are all based on standard .net objects and standard
tools/approaches usually work. Since plagiarism (not in its true sense
of the word) is the best form of programming, here is a link that shows
how to export a dataset to csv.
http://geekswithblogs.net/cubeberg/articles/78814.aspx
> > >
> > > --- In vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
, "jeffery_p_sanders" <jps@> wrote:
> > > >
> > > > I thought this would be the easy part. I was wrong.
> > > >
> > > > As you can see in the code below, I am trying to export the
BAQ's QueryResults to a CSV file. I get the error "Query not found". Any
ideas?
> > > >
> > > > Top part of code is there for reference...The export is between
the asterisks.
> > > >
> > > > Dim startDate as Date = epiDateTimeEditorC1.Value
> > > > Dim endDate as Date = epiDateTimeEditorC2.Value
> > > > Dim baqID as string = "DTSF-FilteredWeeklyTimeExport"
> > > > Dim DQadpt as DynamicqueryAdapter = New
DynamicQueryAdapter(UD35Form)
> > > > DQadpt.BOConnect()
> > > > Dim topNRecords as int32 = 100000
> > > > Dim hasMoreRecords as boolean = True
> > > > Dim resultFieldList as string = ""
> > > > Dim execSet as Epicor.Mfg.Bo.QueryExecutionDataSet =
DQadpt.GetQueryExecutionParametersByID(baqID)
> > > > Dim targetRow as DataRow
> > > > Dim tbl as DataTable = execSet.Tables("ExecutionParameter")
> > > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > > targetRow("ParameterName") = "FirstDate"
> > > > targetRow("ParameterValue") = startDate
> > > > targetRow("ValueType") = "Date"
> > > > targetRow("IsEmpty") = False
> > > > targetRow("RowIdent") = "A"
> > > > tbl.Rows.Add(targetRow)
> > > > targetRow = execSet.Tables("ExecutionParameter").NewRow()
> > > > targetRow("ParameterName") = "LastDate"
> > > > targetRow("ParameterValue") = endDate
> > > > targetRow("ValueType") = "Date"
> > > > targetRow("IsEmpty") = False
> > > > targetRow("RowIdent") = "A"
> > > > tbl.Rows.Add(targetRow)
> > > >
> > > > DQadpt.ExecuteByIDParametrized(baqID, execSet, resultFieldList,
topNRecords, hasMoreRecords)
> > > >
> > > > 'All code above works
> > > >
> > > > '*****************************************
> > > >
> > > > 'Export code
> > > > 'The records I want to export are now found in
DQadpt.QueryResults
> > > >
> > > > dim ds as QueryDesignDataSet = DQadpt.QueryDesignData
> > > > dim pcFile as string = "C:\Test.CSV"
> > > > dim pcFileType as string = "CSV"
> > > > dim pcTextDelim as string = ","
> > > > dim pbOutputLabels as boolean = False
> > > > dim pbSuccess as boolean
> > > >
> > > > Dim fileExported As Boolean = DQadpt.Export(ds, pcFile,
pcFileType, pcTextDelim, pbOutputLabels, pbSuccess)
> > > >
> > > > '*********************************************
> > > > DQadpt.Dispose()
> > > >
> > > >
> > > > Jeff Sanders
> > > >
> > >
> >
>






This e-mail and any attachments may contain proprietary and/or confidential information. If you are not the intended recipient, please notify the sender immediately by reply e-mail or at 410-472-2900 and then delete the message without using, disseminating, or copying this message or any portion thereof. With e-mail communications you are urged to protect against viruses.


[Non-text portions of this message have been removed]