Friday, March 9, 2012

Maximum HEATSeq

I am trying to find out the last record in a table called Asgnmnt using HeatSeq. Trying the below code producess an error stating "A boolean is required here."

code:
{@.Date Convert} = {?Data Select} and
{CallLog.CallStatus} in ["Closed", "Solved", "Suspended", "Implemented"] and
maximum({Asgnmnt.HEATSeq})

Does anyone know how to solve this?code:
{@.Date Convert} = {?Data Select} and
{CallLog.CallStatus} in ["Closed", "Solved", "Suspended", "Implemented"] and
maximum({Asgnmnt.HEATSeq})

what to do with the maximum value. With which value or record you want ot compare it to get the result. curently it will return the maximum value but you need boolean so compare it with any value to get the boolean then your function will work.|||I want to create a report that displays the closed tickets of the dates selected. Right now I am getting all the closed tickets, but if the ticket has been reassigned to another person, I get mutliple ticket showing in the report. I only want the last ticket to be displayed.

what to do with the maximum value: I want to display only this record. The end result should be to display the last record in the array.

With which value or record you want to compare it to get the result: I want to compare each record and only display the last one.

How can I introduce a boolean to compare the maximum value to?|||First: Can you select the desired records by a simple SQL query ?

If you can then apply that in the record selection formula.

You can do this as e.g ticket_date=current_date AND ticket_status = 'Closed'

Then the report will select the the records accordingly then you can sort them of your choice.|||I don't think introducing SQL to the report is necessary. The field HEATSeq shows an number for every re-assignment. If I can figure out how to get the largest HEATSeq number this will resolve my problem.|||I have tried to entering the below SQL code into the report, but it does not display the last ticket. I have tried to run the same below code directly on the SQL database and it does display the last ticket. any ideas?

select * from dbo.Assgnmnt a
where a.heat = (select max (heatseq) from dbo.asgnmnt b where
b.callid=a.callid)
order by callid|||You can add the SQL Query directly in the report by clicking Add Command in the Database - > Set Datasource Location Dialoge.

And then paste your query there.|||I tried that, but that code that I used did not give me the last ticket. Should I take out the other code that I have in Selection Expert?|||Go ahead.

Create a new report only with this query to see how many records are fetched by Crystal Report from the database.

Then you can filter out the unwanted records using the Record Selection Formula or supressing on the report.|||The updated code with SQL looks like this:
{@.Date Convert} = {?Date Select} and
{CallLog.CallSource} = "Web/Chat Room" and
where a.heatseq = (select max(heatseq) from dbo.asgnmnt b where b.callid=a.callid )
order by Asgnmnt.GroupName

I get an error. Message: "A number, currency, amount boolean, date, time, or string is expected here." - system highlights the word "where"

No comments:

Post a Comment