Focal Point
Proper Case Data?

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

December 09, 2005, 05:11 PM
Dan Morphis
Proper Case Data?
Is there a way with WF 7.1.1 to proper-case the data? i.e. I would like to automaticly convert ' PIPE,CULVERT,METALLIC' to 'Pipe,Culvert,Metallic'.


Test: XP / WF 7.1.1
December 09, 2005, 05:17 PM
reFOCUSing
If you are doing a sql pass-through you can use the function INITCAP if your DB is oracle.
December 09, 2005, 06:33 PM
Mikel
Yes Big Grin, there is a very easy way, using LCWORD function.

DM example:
-SET &STR1 = 'PIPE,CULVERT,METALLIC' ;
-SET &STR2 = LCWORD(&STR1.LENGTH, &STR1, 'A&STR1.LENGTH');
-TYPE &STR2

Regards,
Mikel

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


WebFOCUS 8.1.05, 8.2.01
December 12, 2005, 01:42 AM
susannah
nb: LCWORD is quite useful, but you might have to separate your words by a comma and space in order for focus to know they are separate words;




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 12, 2005, 06:40 PM
Dan Morphis
I tried doing:
-SET &Fac = LCWORD(4096, FACILITY.FACILITY.DESCRIPTION, Fac);

in my fex, however when I try to display it using this syntax:

HEADING
"&Fac "


I get:
Facility.Facility for the output

If I change "&Fac" to "<&Fac" I get this error:
THE FIELDNAME IS NOT RECOGNIZED: Facility.Facility


Does anyone have any ideas how to make this work?

-dan

This message has been edited. Last edited by: Dan Morphis,


Test: XP / WF 7.1.1
December 12, 2005, 06:47 PM
Mikel
In this case, try defining a new temp field:

DEFINE FILE FACILITY
  FAC/A4096 = LCWORD(4096, DESCRIPTION, FAC) ;
END

TABLE FILE FACILITY
  HEADING
    "<FAC "


Regards,
Mikel

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


WebFOCUS 8.1.05, 8.2.01
December 12, 2005, 07:27 PM
Dan Morphis
Mikel, thank you for your help!

I'm very new at WF, and this is what I tried in my FEX, but I get this error: (FOC406) THE FIELDNAME IS NOT RECOGNIZED: FACPROPERCASE
.

Here are the first few lines of my FEX:

DEFINE FILE FACILITY
  FACPROPERCASE/A4096 = LCWORD(4096, DESCRIPTION, FACPROPERCASE) ;
END
TABLE FILE FACILITYRESOURCE
SUM
     SEQUENCE NOPRINT
     HOURS
     DESCRIPTION
     CATEGORY
     TYPEHOURS
BY RESOURCEID
HEADING
"Resources for <FACPROPERCASE "


Can you tell me what I'm doing wrong?

Thanks,
dan


Test: XP / WF 7.1.1
December 12, 2005, 07:41 PM
Mikel
FACILITY or FACILITYRESOURCE, what is the name of the master/table?
You must use the correct name both sides (DEFINE FILE and TABLE FILE).

DEFINE FILE FACILITY
...
TABLE FILE FACILITYRESOURCE

Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
December 12, 2005, 07:50 PM
Dan Morphis
quote:
FACILITY or FACILITYRESOURCE, what is the name of the master/table?



I tried to trim down the first part of the FEX to filter out what I thought was extranious info, but I think putting it in here will help explain things:

-* File FacilityResource.fex
DEFINE FILE FACILITY
FACPROPERCASE/A4096 = LCWORD(4096, DESCRIPTION, FACPROPERCASE) ;
END
JOIN
 FACILITYRESOURCE.FACILITYRESOURCE.FACILITY IN facilityresource TO MULTIPLE
 FACILITY.FACILITY.FACILITY IN facility AS J1
 END
JOIN
 FACILITYRESOURCE.FACILITYRESOURCE.RESOURCEID IN facilityresource TO MULTIPLE
 AFCS_RESOURCE.AFCS_RESOURCE.RESOURCEID IN afcs_resource AS J2
 END
TABLE FILE FACILITYRESOURCE
SUM
     SEQUENCE NOPRINT
     HOURS
     DESCRIPTION
     CATEGORY
     TYPEHOURS
BY RESOURCEID
HEADING
"Resources for <FACPROPERCASE "


In the end, Facility.Description is what I want to be proper cased in the HEADING.


Test: XP / WF 7.1.1
December 12, 2005, 08:04 PM
Mikel
Ok, Try again:

-* 1.- First, JOINs (Important, JOIN clears previous DEFINEs)
JOIN
  FACILITYRESOURCE.FACILITYRESOURCE.FACILITY IN facilityresource TO MULTIPLE
  FACILITY.FACILITY.FACILITY IN facility AS J1
END
JOIN
  FACILITYRESOURCE.FACILITYRESOURCE.RESOURCEID IN facilityresource TO MULTIPLE
  AFCS_RESOURCE.AFCS_RESOURCE.RESOURCEID IN afcs_resource AS J2
END

-* 2.- DEFINE over host table (facilityresource) 
DEFINE FILE FACILITYRESOURCE
  FACPROPERCASE/A4096 = LCWORD(4096, DESCRIPTION, FACPROPERCASE) ;
END

-* 3.- Query.
TABLE FILE FACILITYRESOURCE
  SUM
     SEQUENCE NOPRINT
     HOURS
     DESCRIPTION
     CATEGORY
     TYPEHOURS
  BY RESOURCEID
  HEADING
    "Resources for <FACPROPERCASE "
  ...  


Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
December 13, 2005, 02:16 AM
susannah
Dan, you can also do this:
-SET &Fac = LCWORD(29, 'FACILITY.FACILITY.DESCRIPTION', 'A29' );
put your argument in quotes, and
then put the output as a format 'A29' rather than the name Fac.

When using a function in dialog manager (rather than in a define), usually that final argument needs to be a format rather than a fieldname; You'll find this requirement mentioned in the doc. In a define, you can usually use either the receiving field name (as Mikel does in his examples) or the format, in quotes.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 13, 2005, 02:51 PM
Dan Morphis
Mikel,
Your code worked perfectly! Now, I'm trying to do this same thing in another FEX, but I'm getting the dreaded THE FIELDNAME IS NOT RECOGNIZED: FACILITYPROPERCASE

Can you tell me what I'm doing wrong?


-* 1.- First, JOINs (Important, JOIN clears previous DEFINEs)
JOIN
  FACILITY.INSTALLATION.INSTALLATION IN facility TO MULTIPLE
  INSTALLATION.INSTALLATION.INSTALLATION IN installation AS J1
END

-* 2.- DEFINE over host table
DEFINE FILE INSTALLATION
  FACILITYPROPERCASE/A75 = LCWORD(75, DESCRIPTION, FACILITYPROPERCASE) ;
END

-* 3.- Query.
TABLE FILE FACILITY
PRINT
     INSTALLATION NOPRINT
     FACILITY

COMPUTE Type/A35 = LCWORD(35, FACILITY.INSTALLATIONFACILITY.NOUN, Type);

COMPUTE Item/A35 = LCWORD(35, FACILITY.INSTALLATIONFACILITY.DESCRIPTION, Item);
HEADING
"<FACILITYPROPERCASE"
...



Test: XP / WF 7.1.1
December 13, 2005, 02:56 PM
Dan Morphis
quote:
Originally posted by susannah:
Dan, you can also do this:
-SET &Fac = LCWORD(29, 'FACILITY.FACILITY.DESCRIPTION', 'A29' );
put your argument in quotes, and
then put the output as a format 'A29' rather than the name Fac.


Susannah,
I've never been able to make this work properly.

Here is what I have:
-SET &INST = LCWORD(75, INSTALLATION.INSTALLATION.DESCRIPTION, 'A75' );
-* 3.- Query.
TABLE FILE FACILITY
PRINT
     INSTALLATION NOPRINT
     FACILITY
COMPUTE Type/A35 = LCWORD(35, FACILITY.INSTALLATIONFACILITY.NOUN, Type);
COMPUTE Item/A35 = LCWORD(35, FACILITY.INSTALLATIONFACILITY.DESCRIPTION, Item);
HEADING
"&INST"


And here is what I get:
Installation.Installation.Description $€P P A75 J P Ä Àr@@ 


I'm using DevStudio (and the accompying server) for version 7.1.1 on Windows


Test: XP / WF 7.1.1
December 13, 2005, 03:05 PM
Tony A
Dan,

The reason that you are having a problem is for the same basic reason that many new comers have problems, and that is because you are trying to combine Dialogue Manager with actual field values. It doesn't work that way.

Because you want to convert the field DESCRIPTION within TABLE INSTALLATION using connection(?) INSTALLATION, then the field name you are showing is INSTALLATION.INSTALLATION.DESCRIPTION. If you want to use LCWORD on the field then you will have to use DEFINE OR COMPUTE.

Dialogue Manager can only be used on variable values and text strings.

To use your example -
DEFINE FILE FACILITY
LC_Desc/A75 = LCWORD(75, INSTALLATION.INSTALLATION.DESCRIPTION, 'A75' );
END
-* 3.- Query.
TABLE FILE FACILITY
PRINT
 place your fields that you want printed here - not more table names!!
HEADING
"<LC_Desc"


Don't give up, you will wonder why you had problems one day when it all clicks into place!! Smiler

T

This message has been edited. Last edited by: Tony A,



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 
December 13, 2005, 03:31 PM
Mikel
Dan,

You must define FACILITYPROPERCASE field under the JOIN estructure host file, FACILITY table, instead of INSTALLATION table.

DEFINE FILE INSTALLATION FACILITY
FACILITYPROPERCASE/A75 = ...

TABLE FILE FACILITY


Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01