Focal Point
FOCUS to count the length

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8231027112

February 06, 2007, 12:19 AM
<Raghuraman>
FOCUS to count the length
I am in fresher in FOCUS
I have 3 Field in in FOCUS file in
LASTNNAME,FIRSTNAME,INIT
Each size is 25,25,1
data like a
LASTNAME FIRSTNAME INIT
AAAA GGGGGG J
BB EEEE L
CCCCCC GGG O

I want display like

Fullname(40 chacter length)
---------
AAAA, GGGGGG J
BB, EEEE L
CCCCCC, GGG O


How can solve this problem Please give me a solution
February 06, 2007, 02:10 AM
jimster06
You could concatenate the fields using strong concatenation to essentially sqeeze out trailing blanks:

fullname/a40=LASTNAME || ', ' | FIRSTNAME || ' ' | INITIAL;

The two || are strong concatenation and do the squeeze. The single | is a weak concatenation and just strings the two fields together. Note that I have added a comma following the last name and a space following the firstname.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
February 06, 2007, 02:15 AM
DarrenH
Hey Raghuraman,

Try using something like this:

-SET &LASTNAME = 'AAAA';
-SET &FIRSTNAME = 'GGGGGG';
-SET &INITIAL= 'J';

-SET &FULLNAME = &LASTNAME||', '|&FIRSTNAME||' '|&INITIAL;
-TYPE &FULLNAME

Use a double-pipe to concatenate fields (or variables) and a single pipe to enfoce soft concatenation (i.e. to retain the spaces inbetween the elements)

Hope this helps!
-d

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


Prod: Service Manager 5.5 - DataMigrator 7.6 - Win2K
Test: Service Manager 5.5 - DataMigrator 7.6 - Win2K
Local: DevStudio 5.5.3 - Management Console
- Windows XP SP2
February 06, 2007, 03:30 AM
FrankDutch
besides the already mentioned solutions you might consider the fact that 25+25+1 is more than the desired 40 length, so you must add
SHORTFIRTS/A20=EDIT(FIRSTNAME,'99999999999999999999');
and something similar to the other fields.

Frank




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 06, 2007, 04:36 AM
mikipago
Try this,

TABLE FILE myfile
PRINT
COMPUTE CONCAT /A54 = LASTNAME || ',' || (' ' | FIRSTNAME) || (' ' | INITIAL); NOPRINT
COMPUTE FULLNAME/A40 = SUBSTR (54, CONCAT, 1, 40 , 40, 'A40');
END

Michel


WF 8.1.05M/8.2.06,CentOs,Windows,Oracle ,Postgress
February 06, 2007, 06:06 AM
<Raghuraman>
hi all
It not working correctly It display the data with spaces after print the comma(,).
I no need like this one
See
LNAME field length is 25. but the varibale contains only less then or equal 25.
What i want i need to eliminate the space

for example
temp=substr(25,LNAME,1,LENGTH(LNAME),LENGTH(LNAME),TEMP);

LENGTH is not correct statement. Just i put u can easy to understand.
February 06, 2007, 06:47 AM
FrankDutch
maybe a manual will help and some basic courses?

look properly at the piping characters.
you can eliminate the spaces with that function
it works like "Trim" in excel.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 06, 2007, 09:57 AM
Leah
Isn't it wonderful the ways you can solve a problem.

Here's a code snippit as to how we push names to gether

EXPNDNME/A72= FMN_NAME || ( ' ' | LST_NAME | ' ' ) || SFX_NAME || '*' ;
CMPRSNME/A32= GETTOK ( EXPNDNME , 66 , 1 , '*' , 32 , CMPRSNME );
FUL_NAME/A32= LJUST ( 32 , CMPRSNME , FUL_NAME );

EXPNDNME are all the fields conctenated with spacing plus an asterisk, then we use the GETTOK function then LJUST, the LJUST is just a safety measure in case one of the leading fields has blanks. This code has been around since before I came to work at UNO.


Leah
February 06, 2007, 10:15 AM
susannah
If you want to use the SUBSTR function, try the ARGLEN function as well, it measures the exact length of a string.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
February 06, 2007, 10:39 AM
ira
The easiest way to see this would be to set up a define as such:
FULLNAME/A40=LASTNAME||(' '|FIRSTNAME)||(' '|MIDDLEINIT);

THIS WILL INSERT BLANK SPACES BETWEEN THE LAST NAME AND FIRST NAME AND THE FIRST NAME AND THE MIDDLE INIT. jUTS REMEMBER TO SOUND SPACES TOWARD THE NUMBER SPECIFIED IN YOUR DEFINE AS WELL AS THE FIELD NAMES BEING USED. G'lUCK rAGU. iRA


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
February 06, 2007, 11:22 AM
Tony A
ira,

i THINK THAT YOUR cAPS lOCK KEY IS ON Big Grin

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 
February 06, 2007, 11:58 AM
ira
acknowledged. Sorry


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
February 06, 2007, 12:03 PM
ira
quote:
The easiest way to see this would be to set up a define as such:
FULLNAME/A40=LASTNAME||(' '|FIRSTNAME)||(' '|MIDDLEINIT);

THIS WILL INSERT BLANK SPACES BETWEEN THE LAST NAME AND FIRST NAME AND THE FIRST NAME AND THE MIDDLE INIT. jUTS REMEMBER TO SOUND SPACES TOWARD THE NUMBER SPECIFIED IN YOUR DEFINE AS WELL AS THE FIELD NAMES BEING USED. G'lUCK rAGU. iRA

It was pointed out to me that my caps lock was on so let me repost correctly this time:

Place what you want inside a define or -SET. Syntax for the define is as follows:
FULLNAME/A42=LASTNAME||(' '|FIRSTNAME)||(' '|MIDDLEINIT);

This will insert blanks between each part of the fieldnames (if your requirements are commas, simply add them inthe define where needed.
Remember: to include the number of spaces and/or commas being used in your define format.
Ira.. (o and sorry re: the caps lock on b4).


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0