Focal Point
Solved -- Format &variable from a -READ

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

October 12, 2012, 12:19 PM
Spence
Solved -- Format &variable from a -READ
Is there a way to comma edit a variable that is being used from a -READ?

TABLE FILE CAR
SUM SALES RETAIL_COST DEALER_COST
ON TABLE SAVE AS SAVEIT
END
-RUN
-READ SAVEIT &Sales.I6. &Retail.I7. &Dealer.I7.
-RUN
-TYPE &|Sales == &Sales
-TYPE &|Retail == &Retail
-TYPE &|Dealer == &Dealer

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


WF 8 version 8.2.04. Windows.
In focus since 1990.
October 12, 2012, 12:34 PM
Dan Satchell
You could probably use function ARGLEN with or without TRUNCATE to determine how many digits are in the variables and then use EDIT to insert commas. An easier way though, is to convert the values to alphas with commas before you write them to the SAVE file:

TABLE FILE CAR
 SUM
  SALES        NOPRINT
  RETAIL_COST  NOPRINT
  DEALER_COST  NOPRINT
 COMPUTE SALES_ALPHA/A12 = FTOA(SALES,'(D7)','A12');
 COMPUTE RCOST_ALPHA/A12 = FTOA(RETAIL_COST,'(D7)','A12');
 COMPUTE DCOST_ALPHA/A12 = FTOA(DEALER_COST,'(D7)','A12');
 ON TABLE SET HOLDLIST PRINTONLY
 ON TABLE SAVE AS SAVEIT 
END
-*
-RUN
-READ SAVEIT &Sales.12. &Retail.12. &Dealer.12.
-RUN
-TYPE &|Sales == &Sales
-TYPE &|Retail == &Retail
-TYPE &|Dealer == &Dealer



WebFOCUS 7.7.05
October 12, 2012, 12:35 PM
Francis Mariani
Not sure what you mean by "comma edit", -READFILE might be handy (but it's not available for 7.13):

quote:
You can also read a file using the -READFILE command. The -READFILE command reads a file by first reading its Master File and creating Dialogue Manager amper variables based on the ACTUAL formats for each field in the Master File. It then reads the file and, if necessary, converts the fields from numeric values to alphanumeric strings before returning them to the created variables. Display options in the USAGE formats are not propagated to the variables. The names of the amper variables are the field names prefixed with an ampersand (&).

-READFILE [app/]mastername



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 12, 2012, 01:28 PM
Spence
Thanks guys. Dan that works for me. Thanks for your help.


WF 8 version 8.2.04. Windows.
In focus since 1990.