Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: two commands in one report Post Reply Post New Topic
Author Message
rozpalacz
Newbie
Newbie


Joined: 15 Jul 2010
Online Status: Offline
Posts: 5
Quote rozpalacz Replybullet Topic: two commands in one report
    Posted: 17 Jan 2011 at 10:21pm
I have I command_1 tht returns data and simultaneously inserting data to global temporary table (GTT).
I need to execute command_1 first (get data, and put data to GTT) and next execute command_2 that will return data from GTT. I have to do this on one page.

Can I anyway set priority which command should execute first, wait for finish, and execute second command?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 Jan 2011 at 3:34am
not that I know of.  can't you do this via a stored proc, or just select the data that you need.
 
It is my belief that the command was not meant to be used to gather the data for a report, but rather to allow for dynamic parameter retrieval.  With that said, I highly doubt that what you want is available.  I don't know of any options to allow that either.
IP IP Logged
rozpalacz
Newbie
Newbie


Joined: 15 Jul 2010
Online Status: Offline
Posts: 5
Quote rozpalacz Replybullet Posted: 18 Jan 2011 at 9:08pm
Works fine if I have two subraports. One with command1 and second with command2. First subraport gets data and inser new data in GTT via procedure with autonomical transaction. Second subraport takes data from GTT. But how get the same on one raport?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Jan 2011 at 4:14am
Why not change your command to use a second query in itself?
IP IP Logged
rozpalacz
Newbie
Newbie


Joined: 15 Jul 2010
Online Status: Offline
Posts: 5
Quote rozpalacz Replybullet Posted: 19 Jan 2011 at 7:52pm
use a second query in itself
How to do this?
First query (command1) must execute first. Second query (command 2) must execute last.
I have a report for same companies. First command (procedure) return sth like this for two companies:
|  NUMBER  |  COMPANY  |  DAY  |  MONTH  |  YEAR  |  COMPANY  |  DAY  |  MONTH  |  YEAR  |

and second command return exactly this:
|  NUMBER  |  COMPANY  |  DAY  |  MONTH  |  YEAR  |

Command 1 looks like:
select 
  a.number,
  a.company, a.day, a.month, a.year,
  b.company, b.day, b.month, b.year,
from table( REP_PCK.rep(sysdate, 'IBM') ) a
join table( REP_PCK.rep(sysdate, 'SONY') ) b
on (a.number = b.number)

Command 2 looks like:
select number, 'SUM FOR ALL' company, day, month, year
from rap_gtt

I can not do this like this:
select 
  a.number,
  a.company, a.day, a.month, a.year,
  b.company, b.day, b.month, b.year,
  c.company, c.day, c.month, c.year,
from table( REP_PCK.rep(sysdate, 'IBM') ) a
join table( REP_PCK.rep(sysdate, 'SONY') ) b on (a.number = b.number)
join rap_gtt c on (a.number = c.number)
cause I will get no data or data that was in rap_gtt before I execute query.
Ok, I can use two queries but how to set that command 1 should execute first, command 2 has to wait for command 1 and after this just execute.


Edited by rozpalacz - 19 Jan 2011 at 9:09pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Jan 2011 at 4:04am

Rather than what you are currently doing can you tell me what the data is and what you want to get to. I am not sure why you are splitting the two companies into seperate columns rather than just selecting the data or doing a union.



Edited by DBlank - 20 Jan 2011 at 4:07am
IP IP Logged
rozpalacz
Newbie
Newbie


Joined: 15 Jul 2010
Online Status: Offline
Posts: 5
Quote rozpalacz Replybullet Posted: 20 Jan 2011 at 5:13am
I use second command to get summary of all companies.
Are You using Oracle? I can send You an example what I want to get, why and how - PL\SQL procedure, rpt file and example tables.

I just want to know, how execute command_1 (query) that will return data for each company, wait for finish, and next execute command_2 (query) to get summary of all companies. Thats all.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Jan 2011 at 5:39am
Sorry, can't accept files.
Why do you need to get the summaries using a command?
That is what crystal does well so use crystal to do the summarizing for you.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 20 Jan 2011 at 9:25am
Make a single command that is an anonymous PL/SQL block that will run the first query and then the second query.  That way you know that the first part will always run first.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.