Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADD COMMAND Help

Status
Not open for further replies.

EBee

MIS
Aug 10, 2001
229
US
I used ADD COMMAND to grab a date that I need so I can schedule reports that required 4 date parameters to pull current records and compare them to last years records.

However, the record selector below seems to cause the ADD COMMAND for low in the report.

======= section formula record selection ==============

{1stdayCY.calendar_date} = {1stdayCY.calendar_date} and
{1stdayLY.calendar_date} = {1stdayLY.calendar_date} and
{enddate.Expr1000} = {enddate.Expr1000} and
{lyenddate.Expr1000} = {lyenddate.Expr1000} and
{lystartdate.Expr1000} = {lystartdate.Expr1000} and
{startdate.Expr1000} = {startdate.Expr1000} and

({mc_ad_insertion.insertion_date} >= {1stdayLY.calendar_date}) and
({mc_ad_insertion.insertion_date} <= {lyenddate.Expr1000}) and
({mc_ad_insertion.insertion_date} >= {1stdayCY.calendar_date}) and
({mc_ad_insertion.insertion_date} <={enddate.Expr1000}) and
{mc_acct_master_view.bus_unit_id} = "MMB" and
{mc_acct_master_view.pub_id} = "MMB" AND
{mc_ad_detail.adv_type} in ["CL", "GC", "CG"] and
not ({mc_ad_cost_view.obj_code} in ["19", "29", "59", "485", "900", "905", "915"]) and
not ({mc_ad_insertion.prod_code} in ["ELDY"])

======== start date " ADD COMMAND" ====================
select convert(smalldatetime, calendar_date, 112)
from mc_period_dates
where period_year =
(select period_year
from mc_period_dates
where calendar_date = convert(varchar, getdate(), 112)) and
period =
(select period
from mc_period_dates
where calendar_date = convert(varchar, getdate(), 112)) and

day_of_period = 1

=============== enddate ADD COMMAND ========================
select convert(smalldatetime, calendar_date, 112)
from mc_period_dates
where period_year =
(select period_year
from mc_period_dates
where calendar_date = convert(varchar, getdate(), 112)) and

period =
(select period
from mc_period_dates
where calendar_date = convert(varchar, getdate(), 112)) and
day_of_period = 7

========================================================
SQL 2k DB
CR 9

When I took the section formula out. I able to see the data from the add Command.

-ebee
 
EBee,

I am not sure you can use the Add Command in Record Selection - I am under the impression it is a way to introduce data from another datasource without the use of a subreport.

Has anyone been successful in using the Add Command in record selection?

Cheers,
paulmarr
 
I (like many) didn't respond because there isn't anything called a section formula record selection in Crystal, and they have 2 Add Commands without discussing how they are joined.

If ebee needs help with designing a Crystal Report, she/he should state requirements, rather than guessing how Crystal might be used:

Crystal version
Database/connectivity
Example data
Expected output

-k
 
CR9
MENU LIST

REPORT>Section Formulas >Record

LEFT PANE TREE (Record Formulas)
> Record Selection

"RECORD SELECTION FORMULA " editor

I guess I should have called it "Record Selection Formula" editor
 
OK I'll give it a shot, but I'm guessing that since you didn't bother to supply the technical information I requested, this will prove an ungrateful blog:

All of this is meaningless:

{1stdayCY.calendar_date} = {1stdayCY.calendar_date} and
{1stdayLY.calendar_date} = {1stdayLY.calendar_date} and
{enddate.Expr1000} = {enddate.Expr1000} and
{lyenddate.Expr1000} = {lyenddate.Expr1000} and
{lystartdate.Expr1000} = {lystartdate.Expr1000} and
{startdate.Expr1000} = {startdate.Expr1000} and

Comparing fields to themselves is the equivalent of not having it.

Now your Add Commands appear to pull dates, but you don't have any data from what you've posted, so the dates aren't going to do anything but show dates. Details such as the DATA being used, and the output required might be a good idea to include.

I appreciate the effort and volume of your post, but you should just stick to the basics I requested.

As for the intent, just use the equivalent of these Add Commands as subqueries in your real data query.

-k
 
Thank you, you're correct, the first part was on test mode and was taken out. My problem is that, when I used the below record selection formula, it does not even populate the date in my header. And if I take out all the formula in the record selection, the dates displays(warning: I stopped the report in the middle with this test). If I browse the ADD COMMAND, I can see the date.

This may not be the proper solution for what I am trying to do. I may just have to create 4 tables in the database and populate it with a single date that I need for each table.

Thank you --

({mc_ad_insertion.insertion_date} >= {1stdayLY.calendar_date}) and
({mc_ad_insertion.insertion_date} <= {lyenddate.Expr1000}) and
({mc_ad_insertion.insertion_date} >= {1stdayCY.calendar_date}) and
({mc_ad_insertion.insertion_date} <={enddate.Expr1000}) and
{mc_acct_master_view.bus_unit_id} = "MMB" and
{mc_acct_master_view.pub_id} = "MMB" AND
{mc_ad_detail.adv_type} in ["CL", "GC", "CG"] and
not ({mc_ad_cost_view.obj_code} in ["19", "29", "59", "485", "900", "905", "915"]) and
not ({mc_ad_insertion.prod_code} in ["ELDY"])
 
As I mentioned, you can probably just create a single query using the date qualification/filtering as subqueries.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top