Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Alphabetic letter counts

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Alphabetic letter counts
 Login/Join
 
Gold member
posted
Hi
COMPUTE alphanames/A40 = SUBSTR(40, Lastname,1,1,40, 'A40');
This substr picks the first letter in the lastname field, if this is equal to letter 'A' then count all 'A's of lastnames. Like , i need to compare all alphabetic letters and gets their counts for the incoming Lastname field.
the ouput is A B C D..... Z
12 4 1 19...... 4
what is the best logic for this.
Thanks for the help,
Ram

This message has been edited. Last edited by: Kerry,


WebFOCUS 762
Windows
To be decided(All formats)
 
Posts: 52 | Registered: November 02, 2009Report This Post
Master
posted Hide Post
You could, in stead of a COMPUTE, use a DEFINE with the same formula.

DEFINE FILE yourfile
alphanames/A40 = SUBSTR(40, Lastname,1,1,40, 'A40');
END

TABLE FILE yourfile
    SUM CNT.DST.Lastname
    BY alphanames

...output whatever needed...


(unchecked code)

Use a CNT or CNT.DST, depends on what you need.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Gold member
posted Hide Post
Dave,
Thanks for the solution , but what i need is a logic, which gives how many(count) lastnames starts with letter A and how many with(count) lastnames starts with letter B etc...upto Z aplhabetical letters .
Thanks for the help,
ram


WebFOCUS 762
Windows
To be decided(All formats)
 
Posts: 52 | Registered: November 02, 2009Report This Post
Expert
posted Hide Post
How about:
SET NODATA = 0

DEFINE FILE EMPDATA
LASTNAME_1ST_CHAR/A1 = SUBSTR(15, LASTNAME, 1, 1, 1, 'A1');
END

TABLE FILE EMPDATA
SUM
CNT.LASTNAME_1ST_CHAR AS 'EMPLOYEE,COUNT'
BY LASTNAME_1ST_CHAR
ROWS
A OVER B OVER C OVER D OVER E OVER
F OVER G OVER H OVER I OVER J OVER
K OVER L OVER M OVER N OVER O OVER
P OVER Q OVER R OVER S OVER T OVER
U OVER V OVER W OVER X OVER Y OVER Z
END


The ROWS OVER syntax is to ensure all 26 letters appear in the report, you can remove this code if all letters are not required. EMPDATA is a file in the WebFOCUS sample data folder, ibisamp.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Francis,
Compare lastnames with all 26 aplhabets and their corresponding counts.i.e how many lastnames starts with alphabet A and their count.Like all 26 alphabets.
A
count(LASTNAMES)
B
count(lastnames)
thanks,
ram


WebFOCUS 762
Windows
To be decided(All formats)
 
Posts: 52 | Registered: November 02, 2009Report This Post
Expert
posted Hide Post
quote:
Compare lastnames with all 26 aplhabets and their corresponding counts.i.e how many lastnames starts with alphabet A and their count.Like all

I don't understand.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
The output of my program:
   EMPLOYEE
   COUNT
   --------
A         3
B         1
C         6
D         2
E         1
F         1
G         3
H         1
I         0
J         0
K         1
L         4
M         3
N         1
O         1
P         3
Q         0
R         2
S         3
T         0
U         0
V         1
W         4
X         0
Y         0
Z         0


If this is not what you're looking for, please show us your desired output, in between CODE tags please.

[code]
your output here
[/code]


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Francis,
The ouput is correct.Does your logic
is same as this.
COMPUTE alphanames/A40 = SUBSTR(40, Lastname,1,1,40, 'A40');
If alphanames eq 'A' then count(alphanames)
If alphanames eq 'B' then count(alphanames);
If alphanames eq 'C' then count(alphanames);
If alphanames eq 'D' then count(alphanames) ;
.
.
If alphanames eq 'Z' then count(alphanames)
output is
A 20-count of lastnames starts with letter A
B 45--count of lastnames starts with letter B

.
Z 32--count of lastnames starts with letter Z

Thanks


WebFOCUS 762
Windows
To be decided(All formats)
 
Posts: 52 | Registered: November 02, 2009Report This Post
Gold member
posted Hide Post
francis,
Thanks for a wonderful hint. I think i got it.
Thanks for the help,
ram


WebFOCUS 762
Windows
To be decided(All formats)
 
Posts: 52 | Registered: November 02, 2009Report This Post
Master
posted Hide Post
Ram,

I don't get it.. My logic does -exactly- that.
I've made a sample on the CAR file.

It counts the number of cars starting with each character.

DEFINE FILE CAR
	ALPHA/A1 = SUBSTR(40, CAR, 1,1,40, 'A1');
END

TABLE FILE CAR
	SUM CNT.CAR AS 'NUMBER OF CARS STARTING WITH'
	BY ALPHA
ON TABLE PCHOLD FORMAT HTML
END


You will not get the entire alphabet. Only the character which have data.

This fixable :

DEFINE FILE CAR
	ALPHA/A1 = SUBSTR(40, CAR, 1,1,40, 'A1');
END

TABLE FILE CAR
	SUM CNT.CAR AS 'NUMBER OF CARS STARTING WITH'
	BY ALPHA
		ROWS 'A' OVER 'B' OVER 'C' OVER 'D' OVER 'E'
		OVER 'F' OVER 'G' OVER 'H' OVER 'I' OVER 'J'
		OVER 'K' OVER 'L' OVER 'M' OVER 'N' OVER 'O'
		OVER 'P' OVER 'Q' OVER 'R' OVER 'S' OVER 'T'
		OVER 'U' OVER 'V' OVER 'W' OVER 'X' OVER 'Y'
		OVER 'Z' 
ON TABLE PCHOLD FORMAT HTML
END

( working & checked example )

G'luck.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Expert
posted Hide Post
Dave,

Take heart in that most of us knew that your response was, indeed, the solution. However, it was missing the 'A' OVER 'B' etc. has been mentioned on the Forum so many times before so, perhaps, we may have expected a quick pickup.

I guess that some of our newer members do not have the depth of knowledge (or DP background) that would give them the edge to see past the initial response(s) (is that not why they are here?). Consequently many responders may feel slighted or ignored.

Of course we could always suggest that posters remember to use the search engine (top right) but I would urge them to remember that it might need a different search to what is in their mind! This is probably one of the most common reasons for not finding what they need.

A suggestion that I would make to everyone is to signup for the digest and take the time out of their busy schedules to actually read as much as they have time for - even skim reading the content - you never know what might become useful in future. I would also suggest making a library of posted samples, giving the individual files a meaningful name. I know several "seasoned" WF Pro's that keep such a library close to hand on a memory stick.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
No harm done,
Glad I could help anyway.

It's been more a misinterpretation the question at hand.

...isn't that always the problem with our customers as well? Big Grin


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Gold member
posted Hide Post
Hi Dave
very helpful logic.I feel proud of the servise which you are giving it to the forum.
Thanks,
Rama


WebFOCUS 762
Windows
To be decided(All formats)
 
Posts: 52 | Registered: November 02, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Alphabetic letter counts

Copyright © 1996-2020 Information Builders