Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to check if a column exists in a file before COMPUTE?
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] How to check if a column exists in a file before COMPUTE?
 Login/Join
 
Gold member
posted
I have the following code:

TABLE FILE ACR_DATA
SUM
     PER1 AS ''
     PER2 AS ''
     COMPUTE DIFF1/P32BS = PER2 - PER1; AS ''
     PER3 AS ''
     PER4 AS ''
     COMPUTE DIFF2/P32BS = PER4 - PER3; AS ''
     PER5 AS ''
     PER6 AS ''
     COMPUTE DIFF3/P32BS = PER6 - PER5; AS ''
BY SRTING NOPRINT
BY  ORGANIZATION_LEVEL_3 NOPRINT
BY  DEPARTMENT_CODE NOPRINT
BY  SUBJECT NOPRINT
ON  SUBJECT SUBHEAD


That is throwing this error:

0 ERROR AT OR NEAR LINE    383  IN PROCEDURE rom_proj_inst_plan
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: PER4
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT


because I'm finding that PER4 and PER6 columns may not be in the file: ACR_DATA

Anyone have any creative ways to work-around and perform the COMPUTE only if the column exists?

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


8.0.02M, Oracle 11.2 (AIX), Windows 2008R2, HTML, PDF, Excel
 
Posts: 72 | Registered: November 12, 2012Reply With QuoteReport This Post
Virtuoso
posted Hide Post
CHECK FILE ACR_DATA HOLD AS ACRFIELDS
TABLE FILE ACRFIELDS
PRINT FIELDNAME 
IF FIELDNAME EQ PER$$
ON TABLE SAVE
END
-RUN
-SET &PER_COUNT = 0 + &RECORDS;
will capture the count (assuming none of the non-varying fieldnames starts with PER); take it from there.
 
Posts: 1924 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
There is also the SYSCOLUM table that will have this info as well


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.01OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 5916 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
Originally posted by j.gross:
CHECK FILE ACR_DATA HOLD AS ACRFIELDS
TABLE FILE ACRFIELDS
PRINT FIELDNAME 
IF FIELDNAME EQ PER$$
ON TABLE SAVE
END
-RUN
-SET &PER_COUNT = 0 + &RECORDS;
will capture the count (assuming none of the non-varying fieldnames starts with PER); take it from there.


Interesting - I can see the good files have:
  
NUMBER OF FIELDS=    15
 

while the bad (missing columns) have:
 
NUMBER OF FIELDS=    13
 
 
Posts: 72 | Registered: November 12, 2012Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
Originally posted by Waz:
There is also the SYSCOLUM table that will have this info as well


Thanks Waz - I found THIS which I can try to use.
 
Posts: 72 | Registered: November 12, 2012Reply With QuoteReport This Post
Guru
posted Hide Post
Yep

TABLE FILE SYSCOLUM
PRINT COLTYPE LENGTH
WHERE TBNAME EQ 'CAR'
WHERE NAME EQ 'MODEL'
-*ON TABLE SAVE
END
-RUN  


Awesome, thank you.


Senior Business Intelligence Analyst (BIA) @ Enclara Pharmacia
Production: WF 8.09, App Studio, BIP, RC, MSSQL / Test: WF 8202M, App Studio, BIP, RC, MSSQL
 
Posts: 284 | Location: Greater Cincinnati  | Registered: May 11, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to check if a column exists in a file before COMPUTE?

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.