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] Setting an Amper variable from a fex.
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Setting an Amper variable from a fex.
 Login/Join
 
Gold member
posted
After much searching, I am stumped. I am trying to run a fex and then take the ouput from that fex to set an amper variable to be used elsewhere in a larger procedure. This would be like a subroutine. My code is as follows:
-TOP
-SET &ECHO=ALL;
-? &
TABLE FILE RORCRHR
SUM
   	 'RORCRHR.RORCRHR.RORCRHR_AIDY_CODE' AS 'AIDY'
BY 'RORCRHR.RORCRHR.RORCRHR_TERM_CODE' AS 'Term' NOPRINT
WHERE RORCRHR.RORCRHR.RORCRHR_TERM_CODE EQ '&TERM';
ON TABLE SET HOLDFORMAT ALPHA
-*ON TABLE PCHOLD FORMAT HTML
ON TABLE HOLD AS HOLDAIDY
END
-RUN
-READ HOLDAIDY &AIDY.A4. CLOSE
-IF &IORETURN NE 0 GOTO ENDIT;
-TYPE &AIDY
-ENDIT;  


If I run just the fex out to HTML, I get a valid value. Useing -TYPE, is gives me zeros.
Is this possible? What am I doing wrong?

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


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!
 
Posts: 75 | Location: Wichita, KS | Registered: February 19, 2008Reply With QuoteReport This Post
Gold member
posted Hide Post
Try this:

 SET HOLDLIST = PRINTONLY
-SET &IORETURN = 0;

TABLE FILE RORCRHR
SUM
     'RORCRHR.RORCRHR.RORCRHR_AIDY_CODE' AS 'AIDY'
BY 'RORCRHR.RORCRHR.RORCRHR_TERM_CODE' AS 'Term' NOPRINT
WHERE RORCRHR.RORCRHR.RORCRHR_TERM_CODE EQ '&TERM';
ON TABLE HOLD AS HOLDAIDY FORMAT ALPHA
END
-RUN

-REPEAT ENDIT WHILE (&IORETURN EQ 0)
-READ HOLDAIDY NOCLOSE &AIDY.A4.
-TYPE &AIDY
-ENDIT
-CLOSE HOLDAIDY
 


WF 7.6.10, Windows, PDF, Excel
 
Posts: 75 | Location: Dallas, TX | Registered: February 12, 2004Reply With QuoteReport This Post
Gold member
posted Hide Post
Thanks for the reply Mary. I keep getting Error at or Near line 14....
FOC295 A value is missing for &AIDY.

I do get 1 record from the fex which is what is expected.


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!
 
Posts: 75 | Location: Wichita, KS | Registered: February 19, 2008Reply With QuoteReport This Post
Expert
posted Hide Post
Here is another way.

SET HOLDLIST = PRINTONLY

TABLE FILE RORCRHR
SUM
COMPUTE CNTR/I9 = LAST CNTR + 1 ; NOPRINT
COMPUTE CODE/A?? = '-SET &AIDY' || LJUST(FTOA(CNTR,'(F9)','A9'),'A9') || '=''' || 'RORCRHR.RORCRHR.RORCRHR_AIDY_CODE' || ''';' ;
BY 'RORCRHR.RORCRHR.RORCRHR_TERM_CODE' AS 'Term' NOPRINT
WHERE RORCRHR.RORCRHR.RORCRHR_TERM_CODE EQ '&TERM';
ON TABLE HOLD AS HOLDAIDY FORMAT ALPHA
END
-RUN
-SET &AIDYCNT = &LINES ;
-INCLUDE HOLDAIDY
-? &AIDY

-REPEAT AIDYLOOP FOR &CNTR FROM 1 TO &AIDYCNT
-TYPE &AIDY.&CNTR
-AIDYLOOP



Waz...

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

 
Posts: 6132 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
Thank you Mary and Waz. I used tidbits from both and a little more digging and came up with the following:
-TOP
-*SET &ECHO=ALL;
-*? &
DEFINE FILE RORCRHR
AIDY1/A4V=RORCRHR.RORCRHR.RORCRHR_AIDY_CODE;
END
TABLE FILE RORCRHR
BY 'RORCRHR.RORCRHR.RORCRHR_TERM_CODE' NOPRINT
BY 'RORCRHR.RORCRHR.AIDY1'
WHERE RORCRHR.RORCRHR.RORCRHR_TERM_CODE EQ '&TERM';
ON TABLE HOLD AS HOLDAIDY FORMAT ALPHA
END
-RUN
-READ HOLDAIDY,&AIDY1.A10

-IF &IORETURN NE 0 GOTO ENDIT;

-SET &AIDY = EDIT(&AIDY1,'$$$$$$9999');

-ENDIT;
END  


This -INCLUDE takes the parm &TERM and builds an amper variable &AIDY to be used in logic following.
Thanks again. Your help is always valuable.
Paul


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!
 
Posts: 75 | Location: Wichita, KS | Registered: February 19, 2008Reply With QuoteReport This Post
Expert
posted Hide Post
Be wary of using -READ HOLDAIDY,&AIDY1.A10

Two things.

1. The comma in the line tells FOCUS that you are reading comma delimited line of info.
2. You should always have the ending period (.A10.)


Waz...

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

 
Posts: 6132 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
Thank you Waz. My oversite. I still get confused with punctuation in Focus. Your comments are greatly appreciated.


Prod: WF 7.7.05, BID, MRE, 7.7.06M Server, Windows 2008, RedHat, Oracle 11gR1, MS Office 2010
Test: I wish we had one!
 
Posts: 75 | Location: Wichita, KS | Registered: February 19, 2008Reply With QuoteReport This Post
Expert
posted Hide Post
If you are unsure, check the manual.

Actually I think checking the manual is always a good idea.

You don't want to start up some nasty habits. From my experience they become "standard code" and then get caught out in later releases with code tightening.

Also if the documnented code does not work, then techsupport will have to listen to you.


Waz...

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

 
Posts: 6132 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Setting an Amper variable from a fex.

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