Focal Point
[SOLVED] Converting from MtrYY format

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

January 05, 2010, 01:15 PM
ColdWhiteMilk
[SOLVED] Converting from MtrYY format
I have a bar graph report that when a user clicks on one of the bars, it runs a second report to show the detail records. The "on-click" event runs a second query, passing the "by" value from the graph to the second query.

The problem I'm having is that the value being passed to the second query is in MtrYY format, and I need to translate it back to a date value so that I can use that value as the criteria range.

What is the define that would be used to convert a MtrYY back to a YYMD?

Right now, the code passes in "January, 2009" (no quotes), and I get an error message that:

(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: January
BYPASSING TO END OF COMMAND

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


Production - 7.6.4
Sandbox - 7.6.4
January 05, 2010, 01:39 PM
GamP
It's easier than you'd expect. The following code does it for you:
-SET &DATUM = 'January, 2009';
DEFINE FILE CAR
DATUM/MYY WITH COUNTRY = &DATUM.QUOTEDSTRING;
END

TABLE FILE CAR
PRINT DATUM BY COUNTRY
END

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
January 05, 2010, 02:02 PM
Dan Satchell
You will need one additional DEFINE statement to convert the MYY date to YYMD. Since the input date has no day, the resulting YYMD date defaults to the first day of the month.

DEFINE FILE CAR
 DATUM/MYY WITH COUNTRY = &DATUM.QUOTEDSTRING;
 DATE_YYMD/YYMD = DATUM ;
END
-*
TABLE FILE CAR
 PRINT DATE_YYMD
 BY COUNTRY
END



WebFOCUS 7.7.05
January 05, 2010, 03:12 PM
ColdWhiteMilk
Here is the final solution:

DEFINE FILE CLEARRQST
DATUM/YYM WITH CLEARANCE = &RANGE.QUOTEDSTRING;
ENDMM/YYM=DATUM+1;
STARTDT/YYMD=DATUM;
ENDDT/YYMD=ENDMM;
END

TABLE FILE CLEARRQST
PRINT
CLEARANCE

WHERE END_DATE GE STARTDT
WHERE END_DATE LT ENDDT


So the January, 2009 value gets translated to a date range of greater than or equal to 01/01/2009, and less than 02/01/2009.


Production - 7.6.4
Sandbox - 7.6.4