I am trying to set up a BAQ that pulls Multiple quotes and displays only the most recent call log associated with the quote. I have gotten to the point of having all the call logs for a quote populate but I can’t seem to get just the most recent entry to show. Any thoughts on how to possibly solve this issue would be greatly appreciated.
What field are you using to determine the “order” of the call logs?
When I need to find the most recent of something. I’ll make a sub-query that returns the Max of the field I’m using to determine the order (Like TranNum in the PartTran table), then join that sub-query to the main one.
For example, to find that last part tran of each part by tran type:
Make a sub Qry of the PartTran table with display fileds
a. PartNum (Grouped By)
b. TranType (Grouped By)
a. Calculated field of Calc_Max_TranNum = MAX(TranNum) (NOT Grouped By)
Add that sub Qry to the main one (which has the PartTran table in it) relating the Calc_MaxTranNum field to TranNum of the PartTran table in the main qry
I have tried using the multiple date field like “last date” or “orig date” but neither of those worked when i tried to use the Max function. Also tried using the Call Log Sequence but i couldn’t get that to work either. I will try to do something similar to the example you posted. Thank you for your help.
The problem is that i cant have my BAQ only display the most recent call log that was entered.
You can update call logs but my company has decided to avoid doing that and we have gone with creating new call logs each time we complete a phone call.
Thank you for your help again. Unfortunately, that didn’t seem to work either. I think the issue is that the table treats each individual call log as its own string of data so when you ask the BAQ to look at the max sequence it looks at each individual call log. This means that a Sequence 1 call log will have a max sequence of 1 even if there are multiple call logs. I will try to build the BAQ again with your above example. I will let you know if it works on my second try.
We group by CallQuoteNum (or with criteria RelatedToFile=‘QuoteHed’ and then group by Key1 only) and then get MAX(CallSeqNum). You do have to use only those columns, though, and then join back to the full table to get the rest of the data you want.
If you include and group by all the keys then it won’t work.