I'm having a problem getting reports to sort by time. I have a subroutine that uses PrintAReport to create reports when a user chooses a date and clicks a button.
It takes the date and runs a speccommand retrieve, then a spec command sort (based on a time field:ex. 9:45am), and then prints the report. The problem is that its not sorting. I've tried making the sort spec the default for the form and the report, but still, the reports are out of order. Am I missing something?
if it helps, here's the subroutine
#include "sbasic_include.sbas"
subroutine create_reports(store_list as String)
var vTmp as Int
var vList as String
var cur_store as String
var element_count as int
var loop as int
var temp_date as String
var total_orders as int
var total_final as int
total_orders = 0
total_final = 0
temp_date = Delivery Date
if (@IsBlank(Delivery Date))
{
@MsgBox("","You Must Enter a Date","")
}
else
{
element_count = @CountStringArray(store_list)
If @Mode() = 1
{
vTmp = @SelectTreeItem("Search Update Menu!Search (F7)")
}
If @Mode() = 2
{
For loop = 1 to element_count
temp_date = Delivery Date
cur_store = Split(store_list,";")
vTmp = @SelectTreeItem("Search Update Menu!Search (F7)")
Location = cur_store
vList = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_RETRIEVE, "")
vList = @SpecCommand(SPEC_OPERATION_RUN, SPEC_TYPE_SORT, "- Quick Report Sort")
total_orders = @ResultSetTotal()
if (@mode() = 1)
{
vTmp = @PrintAReport("- LUNCH REPORT", REPORT_MODE_HTML, PRINT_ORIENTATION_PORTRAIT, PRINT_NO_DIALOG, -1, -1, -1, -1, -1, -1)
writeln("Creating Lunch Report for "+cur_store+ ". " +total_orders + " orders "+Delivery Date)
total_final = total_final + total_orders
}
else
{
writeln("Skipped "+cur_store+ ". No orders on "+Delivery Date)
}
total_orders = 0
Delivery Date = temp_date
Next
}
writeln("There were "+total_final +" orders in all")
}
end subroutine
Thanks,
D