Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnLastRecord evaluation 1

Status
Not open for further replies.

Ina

Programmer
Feb 7, 2000
41
0
0
US
I am comparing a record to the next one to determine if different, then calculate, else not. When it comes to the last record, it does not calculate because it has no next record to compare to but since it is unique in the sort order, it has to be included. I tried the following formula but it still does not evaluate correctly:<br>
<br>
({text_record} &lt;&gt; Next{text_record} OR onlastrecord) <br>
<br>
Any suggestions?
 
I'm not sure about whether this is exactly what you want, but...<br>
If OnLastRecord then<br>
{text_record} &lt;&gt; Previous{text_record}<br>
Else<br>
{text_record} &lt;&gt; Next{text_record}<br>
This would work if you always have more than one record. Otherwise you have to add a test for that. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
Thanks Malcolm, I hadn't thought about the scenario of getting just one record back, should keep that in mind though.<br>
<br>
I actually solved my own problem by putting an extra set of parentheses around the comparison of current to next record and this seems to have resolved the problem. For those that might be interested:<br>
<br>
(OnLastRecord Or ({text_record} &lt;&gt; next({text_record})) )<br>

 
Nice bit of work - I see you actually made another change that makes it bulletproof, and tests for the case of only one record. By putting the test for OnLastRecord first, this will avoid getting a null result for the record comparison on the last record. If the OnLastRecord clause was in the original position, then even if the last record were unique, it wouldn't show up on your report. Nice way to put it all in one line. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top