JasperSoft Studio Create Incrementing Gift Cards - jasper-reports

I'm using JasperSoft Studio to create a gift card with a barcode. These gift cards do not use any information from a database. They only value that changes is the barcode, which is incremented with a variable. All this is setup and it works.
What I can't figure out how to do is specify the number of gift cards I want to generate. For example, I'd like to print out 100 gift cards. So, the report should generate 100 pages each with an incrementing barcode. I figured I could use a parameter that gives me a prompt when I go to preview, but I don't know how to use that parameter to actually tell Jaspersoft how many pages I want.

For anyone interested, I came up with a solution to this. Here is the JRXML. There is a prompt that asks how many labels you want and the starting point for the barcode id.
One thing to note is the query:
SELECT * FROM dbo.RowGenerator rg WHERE rg.row_num <= $P{HowMany}
This is assuming a Sybase database, so it may not necessarily work on different DBMS's. What this query does it build a resultset of rows with rg.row_num being an incrementing id for each row. For whatever DBMS you use, this will need to be reproduced.

Related

Crystal Reports Parameters - One List rather than pages

All,
My first ever post - here goes!
I am using a Dynamic Parameter to filter a report based on Purchase Order Number.
I have created the Parameter, but only so many results are on the list, then you have to change to page 2 and start looking through again, is there anyway to get all values on a single list.
I have am awaiting my IT Department to do the Registry edit to increase the search size, as I have well over 1,000 records.
Finally, I assume the user couldn't search for a relevant value in the list?
I am using Crystal Reports 2011 64 Bit Version
Any help would be great.

Multiple copies of a record based on formula

Good afternoon,
I am very new to Crystal Reports, so am not sure where to look for this information and would appreciate if someone can point me in the right direction or tell me if what I am asking for is impossible.
One of our departments uses a field called RecordChanges to note changes made to a record. The field is text and the department stores information there about the date a change is made and the type of change, separated by commas (i know this is terribly inefficient, but it's what I have to work with). I have a Crystal Report that parses this text field and picks up the latest date and latest change made to the record. I would like to modify this report to include ALL the changes made to the record, so if the field RecordChanges of the data source has 3 dates, I would like this record to appear in my Crystal Report 3 times, once for each change that was made. How to parse the field I can figure out but where I'm stuck is how do I make the number of times a record appears equal to the number of dates found which is my {#DateFound} field?
There is a lack of details, but as far as I understood the problem and assuming that you did state in the comment that "there wouldn't ever be more than 5 changes to an order", here is a first try to tackle the situation.
I will assume that you already have a formula that "parses this text field and picks up the latest date and latest change made to the record". And that you know how to adjust this formula to pick up each of the record changes. I will name this formula as {#Parser1}.
Based on {#Parser1}, create other 4 formulas: {#Parser2}, {#Parser3}, {#Parser4}, {#Parser5}. As you probably presume, each formula must be changed to parser the Nth occurrence of the record change.
Create 5 details sections.
Put each formula in each detail section.
Suppress the detail section wich formula is null or empty.
That's it.
The limitation is that you can have at most 5 record changes.
This is an awkward solution, but it is necessary (as far as I know) since Crystal Reports works based on your data rows. It iterates over the rows, but cannot "generate" more rows by itself. If you can manipulate the data source, you can create other solutions.
You still need to do the magic trick to pickup the Nth change from the text.

Crystal Reports XI - Group not returned when adding field which might be null

I'm a very new user of Crystal Reports with no training but with a very light background in programming.
I have been working on a report which should show me some information regarding the order status of parts within my company. I have modified an existing report which had a lot of the information I was looking for and have added several fields containing more information I want to look up (information like stock, delivery date, suppliers and partnumbers). I have one last field I want to add to the report, which shows me the name of the supplier where the part is ordered.
Problem:
When I add this field in the report, the groups where there is no information for this field disappear. When I remove the same field again, the missing groups return.
I have tried to look everywhere for an option or function which suppresses a group when a field is null but can not find anything. I also have tried to add an isNull function to return a certain value when the field is empty, but with no results. Unfortunately I can't review the returned values because the group has disappeared when I add the field.
This problem might have to do with the fact I started working from an existing report, but I have not been able to find a reason to believe so.
Update
I have made some pictures showing the problematic result and the SQL-Query (I can only link to the folder in Onedrive because I'm not allowed to post more than two links at the same time):
http://1drv.ms/1J1enHj

Dynamic Table Of Contents - CR

I am currently using crystal reports to create a price list which MUST have a table of contents. The report is passed a dataset from a stored procedure, though I don't think anything I can do server-side will be able to achieve this.
What my question is really is, is there any way of finding what page a particular value in a group header is on, if I can do this I can obviously create an index page with dynamic page numbers easily.

crystal report problem

what is the equivalant command like in vb for EOF(), MoveNext, Moveprevious commands in crystal reports
There are no equivalent answers in Crystal Reports, at least not in the versions I have used. Crystal Reports more or less simply dumps the data out into the report.
That said, if you are in a detail row, and you want to find out what the next value of a field will be, you can use:
next({YourColumn})
You can also find out the previous column value by using this:
previous({YourColumn})
Keep in mind that Next() won't work on the last record, and Previous() won't work on the first record.
I'll have to double-check, but I believe there is an OnLastRecord function that returns TRUE if you are on the last record.
First, welcome to SO!
Second, you sound new to Crystal Report's purpose is to display data, not perform the kind of calculations you're talking about. CR usually goes record-by-record through the data, displaying (or suppressing) each record, and adding group headers & footers.
To answer your question, LittleBobbyTables does give a few good pointers. To see the entire list of functions available to you, there is a list in the Formula Editor (see pic below). Press F1 for detailed descriptions of each command.
You can also:
Create a "Running Total Formula" that will evaluate each record and give a calculation in the group footer.
Do the calculations outside of Crystal Reports and only feed the end result in (perhaps with an unlinked join to your primary table).
The most complex option is to make a subreport that does the calculation and feeds the result back to the main report
Can you give us some more details about what you're trying to do?