Tuesday, March 27, 2012
Dynamic report
I want to create a dynamic report by using code, for ex a report with dynamic column , but dont know where to start and which method is best.
Could you show me some examples about this ?
ThanksThere's a dll that I use called p2smon.dll. This dll has 2 functions:
From scr8_ttxado.pdf which can be found by searching http://support.businessobjects.com/search/advsearch.asp
Using Active Data driver functions
The Active Data driver P2smon.dll (Pdsmon.dll for 16-bit) has two functions that create a TTX file based on a recordset that exists in the VB project. This is the preferred method to create a Data Definition file, as the TTX file will always match the recordset (or vice versa). The two functions available in the DLL are:
CreateFieldDefFile() - Creates a TTX file at runtime based on a recordset.
CreateReportOnRuntimeDS() - Creates a TTX file at runtime based on a recordset. A report (RPT) file is also created off the new TTX file, and there is an option to open the RPT file in the Crystal Reports designer.
These functions are purely for development purposes (they are not required at runtime).
NOTE CreateReportOnRuntimeDS( ) does not place any fields on the report. A blank report is created instead.
The function declarations for CreateFieldDefFile() and CreateReportOnRuntimeDS() are as follows:
CreateFieldDefFile()
Declare Function CreateFieldDefFile Lib "p2smon.dll"(lpUnk As Object, ByVal fileName As String, ByVal bOverWriteExistingFile As Long) As Long
Parameter Description
- LpUnk The active data source used to create the field definition file. In C or C++, this is a pointer to an IUnknown derived COM interface relating to a DAO or ADO Recordset. In Visual Basic, this is a Recordset or Rowset object.
- Filename The path and file name of the field definition file to be created.
- bOverWriteExistingFile If a field definition file already exists with the specified path and file name, this flag indicates whether or not to overwrite that file.
CreateReportOnRuntimeDS()
Declare Function CreateReportOnRuntimeDS Lib "p2smon.dll" ( lpUnk As Object, ByVal reportFile As String, ByVal fieldDefFile As String, ByVal bOverWriteFile As Long, ByVal bLaunchDesigner As Long) As Long
Parameter Description
- LpUnk The active data source used to create the field definition file. In C or C++, this is a pointer to an Iunknown derived COM interface relating to a DAO or ADO Recordset. In Visual Basic, this is a Recordset or Rowset object.
- ReportFile The path and file name of the report file to be created.
- FieldDefFile The path and file name of the field definition file to be created.
- BoverWriteFile If a field definition file already exists with the specified path and file name, this flag indicates whether or not to overwrite that file.
- BlaunchDesigner If True (1), Crystal Reports is launched with the newly created report file opened. Crystal Reports must be installed on the system.
NOTE Since a TTX file is a tab-separated text file, it can be manually created or edited using Microsoft Notepad or any other text editor. This method is not recommended for creating TTX files due to possible typing errors.sql
Thursday, March 22, 2012
Dynamic Partitions using SSIS
I have a client at which I am currently utilizing a method similar to the one found in the Integration Services examples where a SQL query is used to return the partitions that should exist in an SSAS cube. Then the SSIS packge uses the results to see if the partitions exist and creates them if necessary.
This works well, however, I now have the need to handle partitions in a "rolling" fashion. So I want to process the 3 previous months of data into an active partition (or partitions) and roll the "old" stuff in to year partitions.
My thought is that I will want to do this using code rather than relying on a SQL query to tell me what to do because there will be a greater dependency on what actually exists in the SSAS cube. I think I will have to create some logic to see what partitions actually exist and then act on that information. I will also want to merge "old partitions" into the larger year chunks.
Has anyone done anything like this? If so, what did you find worked best and what kind of pitfalls did you find? If I was not clear in my description, please let me know.
Try to look at the materials coming with documentation for project REAL: http://www.microsoft.com/sql/solutions/bi/projectreal.mspx#E3B
There is tons of useful material you'd find there.
Edward Melomed.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Monday, March 19, 2012
dynamic graphics for barcode
I need to create a report with barcodes. Currently I have a method in
asp.net that generates the barcodes by selecting different graphics based on
the characters passed into the method.
Is this possible to do in SRS, or do I need to use a third-party tool to
create the barcode with fonts?
Thanks,
ScottScott,
Have you looked at placing your existing ASP.Net barcode stuff into a
class that is also accessible from the report server? You can include
your own namespaces and then call them (using something like
=Code.MyNameSpace.MyFunc(a) I believe).
Alternatively, you could have a page in your web site that returns a
GIF or JPEG based on the parameters passed to it (such as
http://localhost/mydyanmicbarcode.aspx?BarCode=1234abc) and then access
this via the Image control, setting it to External and the Value to
'http://localhost/mydyanmicbarcode.aspx?BarCode=xxxReportFieldHerexxx'
Ryan|||Great, thanks Ryan, I just discovered this functionality.
That should work for me.
-Scott
"Ryan" wrote:
> Scott,
> Have you looked at placing your existing ASP.Net barcode stuff into a
> class that is also accessible from the report server? You can include
> your own namespaces and then call them (using something like
> =Code.MyNameSpace.MyFunc(a) I believe).
> Alternatively, you could have a page in your web site that returns a
> GIF or JPEG based on the parameters passed to it (such as
> http://localhost/mydyanmicbarcode.aspx?BarCode=1234abc) and then access
> this via the Image control, setting it to External and the Value to
> 'http://localhost/mydyanmicbarcode.aspx?BarCode=xxxReportFieldHerexxx'
> Ryan
>
Wednesday, March 7, 2012
Dynamic date value required for function / view
returning an error: (functions is called from a view)
Incorrect syntax near '('
example:
Select * from myfunction(getdate())
create function myfunction (@.Today datetime)
returns @.mytbl(id int identity(1,1) null, myfield varchar(10) null)
Begin
--do stuff
return
End
Regards,
Jamie
Hi
declare @.dt datetime
set @.dt=getdate()
Select * from myfunction(@.dt)
create function myfunction (@.Today datetime)
RETURNS TABLE
as
RETURN (SELECT
*
FROM
Orders
WHERE
orderdate < = @.Today)
"thejamie" <thejamie@.discussions.microsoft.com> wrote in message
news:BD17A036-4B83-41AC-9C6F-722213242877@.microsoft.com...
> Is there a method to send getdate() to a function without the function
> returning an error: (functions is called from a view)
> Incorrect syntax near '('
> example:
> Select * from myfunction(getdate())
> create function myfunction (@.Today datetime)
> returns @.mytbl(id int identity(1,1) null, myfield varchar(10) null)
> Begin
> --do stuff
> return
> End
>
> --
> Regards,
> Jamie
|||Thanks Uri, but... Ah, if only it were that simple. I gave up on it and
chose an alternate route. The requirement was to see only a specific "dates
between..." from a view. The view can call a function, but a view can't pass
a variable.
Regards,
Jamie
"Uri Dimant" wrote:
> Hi
> declare @.dt datetime
> set @.dt=getdate()
> Select * from myfunction(@.dt)
> create function myfunction (@.Today datetime)
> RETURNS TABLE
> as
> RETURN (SELECT
> *
> FROM
> Orders
> WHERE
> orderdate < = @.Today)
>
> "thejamie" <thejamie@.discussions.microsoft.com> wrote in message
> news:BD17A036-4B83-41AC-9C6F-722213242877@.microsoft.com...
>
>
Dynamic date value required for function / view
returning an error: (functions is called from a view)
Incorrect syntax near '('
example:
Select * from myfunction(getdate())
create function myfunction (@.Today datetime)
returns @.mytbl(id int identity(1,1) null, myfield varchar(10) null)
Begin
--do stuff
return
End
Regards,
JamieHi
declare @.dt datetime
set @.dt=getdate()
Select * from myfunction(@.dt)
create function myfunction (@.Today datetime)
RETURNS TABLE
as
RETURN (SELECT
*
FROM
Orders
WHERE
orderdate < = @.Today)
"thejamie" <thejamie@.discussions.microsoft.com> wrote in message
news:BD17A036-4B83-41AC-9C6F-722213242877@.microsoft.com...
> Is there a method to send getdate() to a function without the function
> returning an error: (functions is called from a view)
> Incorrect syntax near '('
> example:
> Select * from myfunction(getdate())
> create function myfunction (@.Today datetime)
> returns @.mytbl(id int identity(1,1) null, myfield varchar(10) null)
> Begin
> --do stuff
> return
> End
>
> --
> Regards,
> Jamie|||Thanks Uri, but... Ah, if only it were that simple. I gave up on it and
chose an alternate route. The requirement was to see only a specific "dates
between..." from a view. The view can call a function, but a view can't pas
s
a variable.
--
Regards,
Jamie
"Uri Dimant" wrote:
> Hi
> declare @.dt datetime
> set @.dt=getdate()
> Select * from myfunction(@.dt)
> create function myfunction (@.Today datetime)
> RETURNS TABLE
> as
> RETURN (SELECT
> *
> FROM
> Orders
> WHERE
> orderdate < = @.Today)
>
> "thejamie" <thejamie@.discussions.microsoft.com> wrote in message
> news:BD17A036-4B83-41AC-9C6F-722213242877@.microsoft.com...
>
>
Dynamic date value required for function / view
returning an error: (functions is called from a view)
Incorrect syntax near '('
example:
Select * from myfunction(getdate())
create function myfunction (@.Today datetime)
returns @.mytbl(id int identity(1,1) null, myfield varchar(10) null)
Begin
--do stuff
return
End
--
Regards,
JamieHi
declare @.dt datetime
set @.dt=getdate()
Select * from myfunction(@.dt)
create function myfunction (@.Today datetime)
RETURNS TABLE
as
RETURN (SELECT
*
FROM
Orders
WHERE
orderdate < = @.Today)
"thejamie" <thejamie@.discussions.microsoft.com> wrote in message
news:BD17A036-4B83-41AC-9C6F-722213242877@.microsoft.com...
> Is there a method to send getdate() to a function without the function
> returning an error: (functions is called from a view)
> Incorrect syntax near '('
> example:
> Select * from myfunction(getdate())
> create function myfunction (@.Today datetime)
> returns @.mytbl(id int identity(1,1) null, myfield varchar(10) null)
> Begin
> --do stuff
> return
> End
>
> --
> Regards,
> Jamie|||Thanks Uri, but... Ah, if only it were that simple. I gave up on it and
chose an alternate route. The requirement was to see only a specific "dates
between..." from a view. The view can call a function, but a view can't pass
a variable.
--
Regards,
Jamie
"Uri Dimant" wrote:
> Hi
> declare @.dt datetime
> set @.dt=getdate()
> Select * from myfunction(@.dt)
> create function myfunction (@.Today datetime)
> RETURNS TABLE
> as
> RETURN (SELECT
> *
> FROM
> Orders
> WHERE
> orderdate < = @.Today)
>
> "thejamie" <thejamie@.discussions.microsoft.com> wrote in message
> news:BD17A036-4B83-41AC-9C6F-722213242877@.microsoft.com...
> > Is there a method to send getdate() to a function without the function
> > returning an error: (functions is called from a view)
> > Incorrect syntax near '('
> >
> > example:
> > Select * from myfunction(getdate())
> >
> > create function myfunction (@.Today datetime)
> > returns @.mytbl(id int identity(1,1) null, myfield varchar(10) null)
> > Begin
> > --do stuff
> > return
> > End
> >
> >
> >
> > --
> > Regards,
> > Jamie
>
>