[SOLVED] Getting multiple fields using -READFILE not working
I feel certain this worked before, but it isn't now (Note, the table only holds one row):
TABLE FILE MAINT_REPORTING_DATES PRINT BEGINNING_OF_YEAR CURR_REPORTING_MTH_BEGINNING BY CURR_REPORTING_MTH_END ON TABLE HOLD AS HOLD_DATES END -RUN -READFILE HOLD_DATES -DEFAULTH &ME_DATE = ''; -DEFAULTH &CURR_REPORTING_MTH_END = ''; -DEFAULTH &BEGINNING_OF_YEAR = ''; -DEFAULTH &CURR_REPORTING_MTH_BEGINNING= ''; -SET &ME_DATE = EDIT(&CURR_REPORTING_MTH_END,'99/99/9999'); -SET &MB_DATE = EDIT(&CURR_REPORTING_MTH_BEGINNING,'99/99/9999'); -SET &YB_DATE = EDIT(&BEGINNING_OF_YEAR,'99/99/9999'); -SET &HMONTH = FPRINT(&ME_DATE,'Mtr','A9');
In fact, when I run this, I get a "hard kill" error. What is amiss?
Thanks in advance for your help!This message has been edited. Last edited by: DWaybright,
WebFOCUS 8.2.03 (production), 8.2.06 (testing) AppStudio, InfoAssist Windows, All Outputs
February 13, 2019, 09:14 AM
BabakNYC
What's the format of the fields you're holding? Could you first show us what the &variables contain with a -TYPE before you edit them in the -SETs? Let's make sure your data looks right first.This message has been edited. Last edited by: BabakNYC,
WebFOCUS 8206, Unix, Windows
February 13, 2019, 09:34 AM
Addy
Hi, I am not sure why do you need FPRINT, but that is causing the issue. Remove the last line of your code and it should work. as BabakNYC said print your values with Type to see if you are able to read them properly or not and then use functions.
WF 8.2.04 Windows/Unix All Formats In Focus since 2006
February 13, 2019, 10:38 AM
DWaybright
Addy, you're a genius! I removed only the FPRINT statement and it worked. Is there a better way to get the month name and year into an amper variable? THANKS!
WebFOCUS 8.2.03 (production), 8.2.06 (testing) AppStudio, InfoAssist Windows, All Outputs
February 13, 2019, 11:00 AM
BabakNYC
If you do the Month name translation in a Define before you hold the data, you'll get a text in the hold file that'll require no Dialogue Manager editing.
DEFINE FILE retail_samples/wf_retail
Month/Mtr=WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE_DAY_COMPONENT ;
YearMonth/YYM=WF_RETAIL.WF_RETAIL_TIME_SALES.TIME_DATE_DAY_COMPONENT ;
END
TABLE FILE retail_samples/wf_retail
BY Month
BY YearMonth
ON TABLE HOLD
END
-RUN
-DEFAULTH &Month='';
-DEFAULTH &YearMonth='';
-READFILE HOLD
-TYPE &Month &YearMonth