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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
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?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[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, 2012Report 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: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report 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.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report 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, 2012Report 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, 2012Report 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.


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
 
Posts: 291 | Location: Greater Cincinnati  | Registered: May 11, 2005Report 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] How to check if a column exists in a file before COMPUTE?

Copyright © 1996-2020 Information Builders