Count marked records and fill count into another field

Build your list of AccuZIP6 commands by requesting commands and sharing commands with other users

Moderators: Chrissy, Steve, Terry, Donna, Dave, Eric, MartyH, Kristen, Geoff, Vince

Post Reply
User avatar
Eric
Moderator
Posts: 1910
Joined: Tue Sep 19, 2006 3:29 pm
Contact:

Count marked records and fill count into another field

Post by Eric » Wed Feb 14, 2007 9:17 am

This command can take the total number of times a given value is in a field, and put the count into another field. In the example below, if you have 50 marked records, it'll put the number 50 into field1 for every marked record.

Code: Select all

PUBLIC com_Count
SET TALK OFF
COUNT FOR !EMPTY(x) TO com_Count
REPLACE field1 WITH ALLT(STR(com_Count)) FOR !EMPTY(x)
For the sake of looking at a specific value in a field, you could change the last two lines of the command to:

Code: Select all

COUNT FOR "X" $ x TO com_Count
REPLACE field1 WITH ALLT(STR(com_Count)) FOR "X" $ x 
If field1 is a Numeric type field, change the last line of the command to read:

Code: Select all

REPLACE field1 WITH com_Count FOR !EMPTY(x)
Chat with an AccuZIP6 technician weekdays from 7-4 PST with AccuZIP6 Live Online Support

Post Reply