MasterData Asceding by...
Hello, I have a MasterData with 8 fields. 6 of them are subreports and two of them are text objects. The first one is Surnames of customers and they are printing on my report asceding by their name. But I want them to be apperaring asceding by their sales which is the other text box of my MasterData. How can I do that? Thanks.
Comments
If so, then insert the result of your main query into a temp table and your much calculated field will become a standard column. And then use another query reading from this temp table with sort order that you need.
Mick
SALES COMPUTED BY ....
1. OnDialogActivate create empty temp table
2. OnBitBtnClik (when your user has filled the dialog box) fill the temp table with selected customers to be print
3. Build the final query to use content of the temp table.
This depends on your database - is it allows creating temp tables. If not then create standard table, and then OnDialogActivate delete rows from that table to make it ready for newly selected customers. If more than one user can print your report at the same time (which mean they all will use the SAME working table), add UserID to the temp table and delete only User's rows.
You can manage filling the temp table with creating a query on-fly, eg.
MyQry.SQL.Text := 'insert iD, CalcField into tempTab select s.Id, (s.qty * s.tax / s.no) from sales s where ' + MyWhereString
MyQry.ExecSQL
And MyWhereString will be created according to CustIds selected in the dialog.
Mick