I am reading a file into an amper vaiable that consists of one decimal formatted field. I am getting a syntax error on reading the field. A snippet of the code and the error is below. I may be overlooking something.
TABLE FILE MDM_READINGS
PRINT MIN_KW_DEM
BY LOWEST 1 MIN_KW_DEM NOPRINT
WHERE AMI_METER_ID EQ '&METER';
WHERE d_st_date_cvte_hmdyy GE '&ST_DT';
WHERE d_end_date_cvte_hmdyy LE '&END_DT';
WHERE CHANNEL EQ '&KW_CHANNEL';
WHERE UNIT_OF_MEASURE CONTAINS 'KWH';
WHERE MIN_KW_DEM GT &MIN_KW_THRSH;
ON TABLE SAVE AS HOLDA FORMAT ALPHA
END
-RUN
-SET &MIN_KW_DEM = '';
-BEGIN
-READ HOLDA &MIN_KW_DEM.D20.2.
-TYPE &MIN_KW_DEM
-DONE
-EXIT
Error: 0 NUMBER OF RECORDS IN TABLE= 30 LINES= 1 0 ERROR AT OR NEAR LINE 86 IN PROCEDURE ADHOCRQ (FOC224) SYNTAX ERROR: D12 ------------------------vvv -READ HOLDA &MIN_KW_DEM.D12.2.This message has been edited. Last edited by: FP Mod Chuck,
WF 8.1.05 Windows SQL Server 2014 HTML, PDF, EXCEL
July 07, 2017, 02:35 PM
Mike Williams
Not seeing anything that stands out, but personally I've had more luck with -READFILE than having to identify the formats with the -READ.
WF Version 8105
July 07, 2017, 02:36 PM
MartinY
Try using that syntax
SET ASNAMES = ON
TABLE FILE SALES
SUM RETAIL_PRICE AS 'TOT_SALES'
ON TABLE HOLD AS EXT
END
-RUN
-READFILE EXT
-TYPE &TOT_SALES
Using READFILE you don't have to bother about formatThis message has been edited. Last edited by: MartinY,
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
July 07, 2017, 02:44 PM
AMC
Yeah, I normally have more luck with -READFILE also. I had already tried it and I really get the same error:
0 NUMBER OF RECORDS IN TABLE= 1 LINES= 1 ALPHANUMERIC RECORD NAMED HOLDA 0 FIELDNAME ALIAS FORMAT LENGTH MIN_KW_DEM D12.2 12 RNK$$00102 I6 6 TOTAL 18 1 0 NUMBER OF RECORDS IN TABLE= 30 LINES= 1 0 ERROR AT OR NEAR LINE 86 IN PROCEDURE ADHOCRQ (FOC224) SYNTAX ERROR: &MIN_KW_DEM ----------------vvvvvvvvvvv -READFILE HOLDA &MIN_KW_DEM
WF 8.1.05 Windows SQL Server 2014 HTML, PDF, EXCEL
July 07, 2017, 03:23 PM
AMC
MartinY - I tried using the actual syntax you posted and it worked. I have it below. Thanks for your help and thanks to the other individuals for helping out on this thread.
TABLE FILE MDM_READINGS PRINT MIN_KW_DEM BY LOWEST 1 MIN_KW_DEM NOPRINT WHERE AMI_METER_ID EQ '&METER'; WHERE d_st_date_cvte_hmdyy GE '&ST_DT'; WHERE d_end_date_cvte_hmdyy LE '&END_DT'; WHERE CHANNEL EQ '&KW_CHANNEL'; WHERE UNIT_OF_MEASURE CONTAINS 'KWH'; WHERE MIN_KW_DEM GT &MIN_KW_THRSH; ON TABLE HOLD AS HOLDA END -RUN
WF 8.1.05 Windows SQL Server 2014 HTML, PDF, EXCEL
July 07, 2017, 03:25 PM
AMC
[Solved]Originally posted by AMC: I am reading a file into an amper vaiable that consists of one decimal formatted field. I am getting a syntax error on reading the field. A snippet of the code and the error is below. I may be overlooking something.
TABLE FILE MDM_READINGS
PRINT MIN_KW_DEM
BY LOWEST 1 MIN_KW_DEM NOPRINT
WHERE AMI_METER_ID EQ '&METER';
WHERE d_st_date_cvte_hmdyy GE '&ST_DT';
WHERE d_end_date_cvte_hmdyy LE '&END_DT';
WHERE CHANNEL EQ '&KW_CHANNEL';
WHERE UNIT_OF_MEASURE CONTAINS 'KWH';
WHERE MIN_KW_DEM GT &MIN_KW_THRSH;
ON TABLE SAVE AS HOLDA FORMAT ALPHA
END
-RUN
-SET &MIN_KW_DEM = '';
-BEGIN
-READ HOLDA &MIN_KW_DEM.D20.2.
-TYPE &MIN_KW_DEM
-DONE
-EXIT
Error: 0 NUMBER OF RECORDS IN TABLE= 30 LINES= 1 0 ERROR AT OR NEAR LINE 86 IN PROCEDURE ADHOCRQ (FOC224) SYNTAX ERROR: D12 ------------------------vvv -READ HOLDA &MIN_KW_DEM.D12.2.[/QUOTE]
WF 8.1.05 Windows SQL Server 2014 HTML, PDF, EXCEL
July 10, 2017, 05:35 AM
Tony A
The only valid READ formats are alpha and integer. Hence D12.2 is invalid.
e.g. -READ filename &variable.A8. or -READ filename &variable.I8.
There should be a period before and after the format attribute.
As Martyn suggests, using -READFILE is a much better method as it will use both the filednames as the variable names plus the formats.
If you wish to use decimals within dialogue manager, you should also consider using SET DMPRECISION = n.
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