[FAQ] VReports & Query -- why in ADK code we need repeat query?

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Sat Dec 1 09:46:27 CST 2012


On 01/12/2012 07:38, "Tim Seyfarth" <tjs at global-electronics.com> wrote:

Hi Tim,

> Ruslan,
> 
> I want to be clear here.  If the .vsp *knows* the datasource, and the
> Query, why is it necessary to create a new query in code in RS (the
> target user of the .vsp file)?
> 
> I can certainly understand why a data source/connection string would be
> mandatory.  Particularly since the development environment is different
> than the installed user environment.  However, why also require a
> duplicate Query necessary to be passed?  I would expect that this would
> not be necessary - since it was designed into the .vsp file.   An
> option, may be good, but not mandatory....
> 
> For example, see this code:
> mProjectPath = getFolderItem( "ConnexReports.vsp" )
> 
> mReport = mProject.MakeNewReport(ReportNo, ConStr, q)
> 
> 
> **q is a string with a quite long SQL command (see below).  Why is that
> necessary when it is already part of the .vsp file?

Okay I see your question.
I will CC to Valentina beta list for now


1) Let you have some report R1, which prints passport of a person.
    ONE PERSON with some ID ==> ONE PAGE.


2) REPORT engine take some CURSOR of some QUERY.
And produce ONE report for each record of cursor.


3) when developer design s report in Valentina Studio,
He usually use query that return one record in cursor.
Really what sense for developer to get cursor with million records
and wait while will be produced million pages?


4) But at runtime, in application, can be different behaviros,
  * some time you may want print only ONE person.
  * Sometimes you may want print persons born in 1990 year
  * Sometimes you may want print persons - students of group A.

In all this case you need to use different queries.
They will with sure differ in WHERE part.

SELECT f1, f2, f3
FROM tblPerson
WHERE ID = 545

SELECT f1, f2, f3
FROM tblPerson
WHERE ID in (545, 596, 698, 521)

SELECT f1, f2, f3
FROM tblPerson
WHERE fldBornYear = 1990

But then can even differ much more

SELECT f1, f2, f3
FROM tblPerson join tblB ON ...
WHERE ID = 545 and tblB.SomeField = something


FOR REPORT R1 -- IMPORTANT IS only that cursor returns the same FIELDS!
      f1, f2, f3

Can be a lots of other forms of queries STILL COMPATIBLE to report R1.
Can be views, can be even Stored Procedures that return a cursor.


Note, that even for single person, you need different queries to specify
that ID. Right?

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list