Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create a Array start # to end # In Crystal

Posted on 2014-04-02
4
343 Views
Last Modified: 2014-04-02
I have yet another crazy Crystal approach where a SQL table {dbo.sales} timestamps a batch of created ticket numbers for example a sale where a client purchased qty 50 tickets on datetime and the starting number is 12340 and ending number 12389.

I have another table {dbo.transactions} when these actual tickets are being used for example on {dbo.datetime} ticket number 12341 was used.

I want to create a Crystal formula (@TicketSold) where the ticket number used checks the {dbo.Sales} table or however and shows the date when this 'used ticket' was created.

I'm guessing that each time tickets are sold (qty) I want to create an array reference with that date for the start to end numbers.
0
Comment
Question by:John-S Pretorius
  • 2
  • 2
4 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 39972827
Is there a single record in the dbo.sales table for the entire transaction or does each ticket have its own record.

If each ticket sold has a record then simply add the sales table and link on the ticket number to the transaction table.
There will be no lookup as you see just use the date sold field in the report.

 If there is a range you have other options
1.  Use a SQL Expression
2.  Use a subreport linked on the ticket number
3.  Use a Crystal Command

What database do you have?
If it is Oracle the first option is probably not available.

The third will be something like

SELECT dbo.transactions.ticketNumber, dbo.transactions.transactiondate, dbo.sales.salesdate, other fields you need
FROM dbotransactions INNER JOIN dbo.sales ON dbo.transactions.ticketnumber >= dbo.sales.ticketnumberfirst AND dbo.transactions.ticketnumber <= dbo.sales.ticketnumberlast

You may have to do the join  filter in the where clause
SELECT dbo.transactions.ticketNumber, dbo.transactions.transactiondate, dbo.sales.salesdate, other fields you need
FROM dbotransactions, dbo.sales
WHERE
dbo.transactions.ticketnumber >= dbo.sales.ticketnumberfirst AND dbo.transactions.ticketnumber <= dbo.sales.ticketnumberlast

mlmcc
0
 

Author Comment

by:John-S Pretorius
ID: 39972851
It is a SQL Database and each sale is typically part of a range, so if just ticket is being sold it's ok since the {dbo.FromNumber} and the {dbo.ToNumber} will be the same but if the quantity is more than 1 I just have a datetime stamp with a quantity.

Would another approach be possible to have a looped Array "FromNumber' to 'ToNumber as a global variable which runs against all sales in a subreport.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39973238
Crystal works on 1 record at a time so looping really doesn't exist.

You can try a SQL expression

(
   SELECT   dbo.sales.CustomerID FROM dbo.sales WHERE dbo.sales.FromNumber <= {dbo.transaction.TicketNumber} AND dbo.sales.ToNumber >= {dbo.transaction.TicketNumber}
)

You can also use a subreport.
Link it on the ticket number
selecting on FromNumber

You can then edit the selection formula in the subreport to be

dbo.sales.FromNumber <= {?pm_TickectNumber} AND dbo.sales.ToNumber >= {?pm_TickectNumber}


mlmcc
0
 

Author Closing Comment

by:John-S Pretorius
ID: 39973259
Thank you
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question