Focal Point
[SOLVED] Show Month and Year from today's date

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

September 06, 2018, 01:42 PM
Deej
[SOLVED] Show Month and Year from today's date
I'm trying to use the "SET-" operation to take today's date (in the &YYMD format) and have it show up with just the Month and 4-digit year (ie Sep 2018).

With a million combinations of date formats, I can't quite figure out which ones will make it show up correctly.

Using v8.1.05

Any suggestions?

This message has been edited. Last edited by: FP Mod Chuck,



WebFOCUS 8.1.05
Windows, All Outputs
September 06, 2018, 01:57 PM
BabakNYC
  
-SET &CMONTHYYM=EDIT(&YYMD,'999999');
-TYPE &CMONTHYYM



WebFOCUS 8206, Unix, Windows
September 06, 2018, 02:04 PM
jfr99
One way ...

-SET &T1_MYY  = EDIT(FPRINT(DATECVT(&YYMD,'I8YYMD','MYY'),'MtYY','A09'),'999$99999');
-TYPE ----------------------
-TYPE YYMD -------- &YYMD
-TYPE T1_MYY ------ &T1_MYY
-TYPE ----------------------  



WebFocus 8.201M, Windows, App Studio
September 06, 2018, 02:08 PM
Deej
Thanks BabaNYC. Looks like that gets me to '201809', but I'm looking for 'Sep 2018'.

Did I not do something correctly?



WebFOCUS 8.1.05
Windows, All Outputs
September 06, 2018, 02:13 PM
Deej
quote:
Originally posted by jfr99:
One way ...

-SET &T1_MYY  = EDIT(FPRINT(DATECVT(&YYMD,'I8YYMD','MYY'),'MtYY','A09'),'999$99999');
-TYPE ----------------------
-TYPE YYMD -------- &YYMD
-TYPE T1_MYY ------ &T1_MYY
-TYPE ----------------------  

I think I can get that to work. Thanks!!



WebFOCUS 8.1.05
Windows, All Outputs
September 06, 2018, 02:31 PM
BabakNYC
I'm wondering why you need this format in a Variable. Will you be using it in a report as a parameter?


WebFOCUS 8206, Unix, Windows
September 06, 2018, 03:07 PM
jfr99
A couple other ways ...

-TYPE -----------------------
-TYPE YYMD -------- &YYMD
-TYPE DATEMt ------ &DATEMt
-TYPE DATEYY ------ &DATEYY
-TYPE DATEMtYY ---- &DATEMtYY
-TYPE -----------------------
-SET &T1_MYY  = EDIT(FPRINT(DATECVT(&YYMD,'I8YYMD','MYY'),'MtYY','A09'),'999$99999');
-TYPE T1_MYY ------ &T1_MYY
-TYPE -----------------------
-SET &T2_MYY  = EDIT(&DATEMtYY.QUOTEDSTRING,'999$99999');
-TYPE T2_MYY ------ &T2_MYY
-TYPE -----------------------
-SET &T3_MYY  = &DATEMt | ' ' | &DATEYY;
-TYPE T3_MYY ------ &T3_MYY
-TYPE -----------------------
-SET &T4_MYY  = '&DATEMt.EVAL &DATEYY.EVAL';
-TYPE T4_MYY ------ &T4_MYY
-TYPE -----------------------



WebFocus 8.201M, Windows, App Studio
September 06, 2018, 03:51 PM
BabakNYC
I'm still not sure what the use case is for these contortions. There are plenty of ways to get these formats with DEFINE and TABLE but I'm at a loss why one needs an &VARIABLE that has these values.

Just saying!


WebFOCUS 8206, Unix, Windows
September 06, 2018, 05:17 PM
Waz
quote:
I'm at a loss why one needs an &VARIABLE that has these values


From my experience, the longer you've been in the business, the more you find the need for these "obscure" variables.

My guess is that an important customer has asked for it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 07, 2018, 08:40 AM
BabakNYC
My point is there are many ways to display different date formats in a report. The point of populating an &Variable with a value is to use it in a WHERE test or pass it to a drill down report. In either case, having an &Variable set to SEP 2018 doesn't seem to help with a WHERE test. That's why I'm wondering what other use is there in having that value in an &Var.


WebFOCUS 8206, Unix, Windows
September 07, 2018, 09:04 AM
Tony A
quote:
what other use is there

Display as in a heading?

Don't forget that there are &DATEDMYY, &DATEDMtrYY and the various alternatives. Give the option and it will be used!!

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 
September 07, 2018, 09:20 AM
Deej
quote:
Originally posted by BabakNYC:
I'm wondering why you need this format in a Variable. Will you be using it in a report as a parameter?

Using as a dynamic column heading on a year-over-year revenue report. First column is this month (Sep 2018), second column is same month last year (Sep 2017), etc.

-SET &T1_MYY  = EDIT(FPRINT(DATECVT(&YYMD,'I8YYMD','MYY'),'MtYY','A09'),'999$99999');

TABLE FILE YOYREVENUE
PRINT
	 TOTAL_SALES AS '&T1_MYY'  




WebFOCUS 8.1.05
Windows, All Outputs
September 07, 2018, 09:30 AM
BabakNYC
Thank you that makes sense.


WebFOCUS 8206, Unix, Windows