Click to See Complete Forum and Search --> : Report help please...


jspisak
November 27th, 2006, 01:57 PM
Hey guys,

Im kind of new to crystal, well enough to be dangerous anyway... but I have a report that I am trying to build. let me give you a little background on what the database is like so you have an idea of what Im trying to do. I am reporting against a SQL database that is our CRM system, which we track calls in. so you open a ticket, and then there are journal entries that are linked to that object in another table.

so what i want to do is display the open calls for a particular company, and the last two journal entries.

what i have so far, is everythign but the last two journal entries. i can get it to display all of them, but i only want the last two.. otherwise the report is way to big. i was thinking there must be a "TOP" type function or somethign kind of like in sql, where i could say only top 2 or something like that.. any help would be good... thanks!

lucia
November 27th, 2006, 03:45 PM
Have you tried this:

"SELECT TOP 2 * FROM YourTable ORDER BY OneField Desc"

I think this SQL will extract last 2 items.

jspisak
November 27th, 2006, 04:12 PM
I have thought about doing that, but not really sure where to put it... i mean there are so many spots in crystal to put formulas... do i put it right on the field? on the section of the report? or where??? right now im trying to use the suppress function with a formula, thinking it should work.. but its not... either it suppresses everythign or nothing... i cant get it to work if the formula condition is met, which the help files says that it should work like that...

im trying

{mytable.datecolumn} < Last7Days

figured ok if it is less then the last 7 days then suppress it... but that doesnt seam to work..

lucia
November 27th, 2006, 05:13 PM
I have thought about doing that, but not really sure where to put it...

I use Vb code to execute SQL. Have you tried SQL Expression Fields on CR?