Get list of months

1 view
Skip to first unread message

ronal.v...@gmail.com

unread,
Jul 24, 2013, 1:14:06 PM7/24/13
to InterSy...@googlegroups.com
hello all.
Sorry for my English.

As I can get into a cycle a list of months of the year?

Edward Clark

unread,
Jul 24, 2013, 3:04:38 PM7/24/13
to InterSy...@googlegroups.com
On any mv platform you could do something like:
0001 D=15
0002   FOR I=1 TO 12
0003     CRT OCONV(D,'DMA')
0004     D+=30
0005 NEXT I
 
which in my locale prints:

JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
 
(Note that the output is emulation dependent. In the default Cache emulation, the month names are forced to upper-case, but in some other emulations they are not).
 
On Cache, these names actually come from the locale. You can view/edit the locale through the management portal, or via classes in the Config.NLS package.
(unless you use package mapping to map it to other namespaces, the Config.NLS package is only visible from the %SYS namespace/SYSPROG account.)
So for example:
 
0002 execute "LOGTO SYSPROG"
0003 locale="Config.NLS.Locales"->OpenCurrent()
0004 crt locale->MonthName
0005 execute "LOGTO ":here
 
which prints:
 January February March April May June July August September October November December
 
The property value is just a space-delimited string, with a leading space.
 


From: InterSy...@googlegroups.com [mailto:InterSy...@googlegroups.com] On Behalf Of ronal.v...@gmail.com
Sent: Wednesday, July 24, 2013 1:14 PM
To: InterSy...@googlegroups.com
Subject: [InterSystems-MV] Get list of months

hello all.
Sorry for my English.

As I can get into a cycle a list of months of the year?

--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to InterSystems-...@googlegroups.com.
To post to this group, send email to InterSy...@googlegroups.com.
Visit this group at http://groups.google.com/group/InterSystems-MV.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

ronal.v...@gmail.com

unread,
Jul 25, 2013, 10:25:48 AM7/25/13
to InterSy...@googlegroups.com, edward...@intersystems.com
thanks a lot Edward.

I wanted to convert this code to cache csp page, but could not find a function like this is the code oconv try to convert:

<script language="cache" runat="server">
Set vc=15
For i=1:1:12 {
write OCONV(vc,"DMA")
    set vc = vc + 30
}
</script>

my question is there any oconv fucnion cached like?

Thanks for your reply Regards


El miércoles, 24 de julio de 2013 13:04:38 UTC-6, Edward Clark escribió:
On any mv platform you could do something like:
0001 D=15
0002   FOR I=1 TO 12
0003     CRT OCONV(D,'DMA')
0004     D+=30
0005 NEXT I
 
which in my locale prints:

JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
 
(Note that the output is emulation dependent. In the default Cache emulation, the month names are forced to upper-case, but in some other emulations they are not).
 
On Cache, these names actually come from the locale. You can view/edit the locale through the management portal, or via classes in the Config.NLS package.
(unless you use package mapping to map it to other namespaces, the Config.NLS package is only visible from the %SYS namespace/SYSPROG account.)
So for example:
 

Edward Clark

unread,
Jul 25, 2013, 10:46:33 AM7/25/13
to ronal.v...@gmail.com, InterSy...@googlegroups.com
OCONV is an mvbasic function. if you need to do this type of conversion from object script you can use the $MVOCONV() object script function, but if you are primarily coding in object script then look at the documentation for the $ZDATE() function.


From: ronal.v...@gmail.com [mailto:ronal.v...@gmail.com]
Sent: Thursday, July 25, 2013 10:26 AM
To: InterSy...@googlegroups.com
Cc: Edward Clark
Subject: Re: [InterSystems-MV] Get list of months

Reply all
Reply to author
Forward
0 new messages