Focal Point
[WORKAROUND] How to Read values from Foccache Table

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

November 29, 2012, 04:43 PM
Joey Sandoval
[WORKAROUND] How to Read values from Foccache Table
I have a foccache table called customer_id that stores 3 values: Customer Type, Customer ID, Customer Name.

I am trying to use the following code to retrieve the "Customer ID" from a procedure that I am using to populate long and latitudes for a specific customer.

  
FILEDEF CUSTOMER_IDS DISK FOCCACHE/CUSTOMER_IDS.FTM
-RUN
-READ CUSTOMER_IDS  &CUST_ID.A100. 
-RUN

-TYPE &CUST_ID
-RUN
-EXIT


The following code produces "000008Customer". However what is stored in the foccache table is

Customer Type = Customer
Customer ID = 770
Customer Name = "(confidential)"

How can I read this foccache table properly?

Thank you

This message has been edited. Last edited by: Joey Sandoval,




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


November 29, 2012, 05:13 PM
Dan Satchell
You may need to store your FOCCACHE file with:

ON TABLE SAVE AS CUSTOMER_IDS
or
ON TABLE HOLD AS CUSTOMER_IDS FORMAT ALPHA  

Also, make sure your customer fields are not variable length.


WebFOCUS 7.7.05
November 29, 2012, 05:21 PM
Tony A
As you are on 7.7.03 you can now use READFILE -

-DEFAULTH &COUNTRYV='', &CAR='', &MODEL='', &RETAIL_COST=0
DEFINE FILE CAR
  COUNTRYV/A20V = COUNTRY;
END
TABLE FILE CAR
  SUM RCOST
   BY COUNTRYV
   BY CAR
   BY MODEL
ON TABLE HOLD AS FOCCACHE/CARHOLD
END
-RUN
-READFILE CARHOLD
-REPEAT :Loop WHILE &IORETURN EQ 0;
-TYPE &COUNTRYV &CAR &MODEL &RETAIL_COST
-READFILE CARHOLD
-:Loop

Because the -READFILE is using the synonym to read the values, the variable aspect is taken care of for you.

T



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 
November 29, 2012, 06:26 PM
Joey Sandoval
Thank you Tony. I was able to read the value in my development folder. But when I try it from a procedure in Managed Reporting, it is prompting me for the variable that I am trying to read..




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


November 30, 2012, 08:08 AM
RSquared
Take a look at the properties for your .fex and uncheck the ;Prompt for parameters' box.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
November 30, 2012, 12:20 PM
Joey Sandoval
Thank you all for your input. I was actually able to avoid using a READ command by just doing an inner join with the foccache table and the table needed.

Thank you




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro