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     Interrogating a field's format

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Interrogating a field's format
 Login/Join
 
Member
posted
Can I check the format of a field from within a DEFINE?

I wish to determine if a field is integer, decimal or alpha-numeric. Is there a function to do this?


Web FOCUS 7.6.11
 
Posts: 7 | Registered: April 23, 2003Report This Post
Expert
posted Hide Post
I'm guessing that the field exists in a file and you don't have access to the master?
or is this a DM field?
If DM, then use the .TYPE suffix and test if
&MYVAR.TYPE is 'A' or 'N', for starters.
If this field is in a master and you just don't know about it, then in your fex,
CHECK FILE mastername HOLD
TABLE FILE HOLD PRINT FIELDNAME FORMAT
if you do this on the car file , you'll get
PAGE 1 
 
FIELDNAME FORMAT 
COUNTRY A10 
CAR A16 
MODEL A24 
BODYTYPE A12 
SEATS I3 
DEALER_COST D7 
RETAIL_COST D7 
SALES I6 
LENGTH D5 
WIDTH D5 
HEIGHT D5 
WEIGHT D6 
WHEELBASE D6.1 
FUEL_CAP D6.1 
BHP D6 
RPM I5 
MPG D6 
ACCEL D6 
WARRANTY A40 
STANDARD A40 





In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
<JG>
posted
You can not have a field in a define that you do not know the format of.
WebFocus does not allow that.

You can have a field that contains a value that is of a different format.
Or you can have a variable that you may not know the format of that you are
trying to assign to a defined field (only an issue for numbers as if you are assigning
it to an alpha you just wrap it in quotes).

Alpha is the only format that can legitimately contain ABC 123 -123 1.23 -1.23 1,200.3 or 1.2.3

As Susannah says using .TYPE as a suffix for DM variables can help but it has the
limitation that it only identifies numerics if they only contain numbers a decimal point or a - sign
i.e. 1234 1.234 -1.234 etc are returned as type N, 1,234 or 1,234.00 are returned as being type A.
(not really that smart).

Your only real option is to write some extended IF-THEN-ELSE logic to handle it.
 
Report This Post
Master
posted Hide Post
There may be a couple of way to check the format of a field and have a dynamic field format in DEFINE FILE xxxx. This is How I am doing it in one of my programs.
  
DEFINE FILE SYSCOLUM
TYPE/A4 = EDIT(COLTYPE, '9999$');
END

TABLE FILE SYSCOLUM
PRINT
NAME
TYPE
LENGTH
WHERE TBNAME EQ '&1';
WHERE NAME EQ '&2';
ON TABLE HOLD AS COLINFO FORMAT ALPHA
END

? HOLD COLINFO
-RUN
-SET &LINE = '';
-READ COLINFO CLOSE &FLDNAME.A66. &FLDTYPE.A4. &FLDLENG.A4.
-SET &FLDNAME = TRIMV('B', '&FLDNAME.EVAL', &FLDNAME.LENGTH, ' ', 1, 'A66V');
-SET &FLDLENG = TRIMV('B', '&FLDLENG.EVAL', &FLDLENG.LENGTH, ' ', 1, 'A4V');
-SET &AFORMAT = 'A' | &FLDLENG;
-RUN
DEFINE FILE xxx
DYNFLDFMT/&AFORMAT = your code here;

I do have seperate defines one for VARC(VARCHAR) AND CHAR and Another one for everything else.
Check &FLDTYPE for the field type, It only have the first 4 characters for the TYPE.




Hope this helps

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




Scott

 
Posts: 865 | Registered: May 24, 2004Report 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     Interrogating a field's format

Copyright © 1996-2020 Information Builders