WOW!!  Thanks Ben!

I was thinking that it wasn't going to be nice and clean, but wanted to make 
sure I wasn't missing a nice FUNCTION that I could have used.

Thanks again!

Lisa

From: Action Request System discussion list(ARSList) 
[mailto:[email protected]] On Behalf Of Ben Chernys
Sent: Thursday, May 19, 2011 4:11 PM
To: [email protected]
Subject: Re: String to Date Function

**
Lots of ways to do it:


1)      A set fields off a small table with AUG in one column and 08 in another 
(can be enhanced easily to handle locales)



2)      A guide (a general rule is to always use guides for discrete functions) 
that has a bunch of filters (or ALs if that is what you are thinking) with 
specific qualifications such as 'x' = "AUG" and actions set fields, goto end of 
guide



3)      Use a set fields with the STRSTR f() as in STRSTR("JANFEBMAR...", 'x')
then a second filter to throw an error if -1 else divide the number by 3 and 
add 1 yielding the month - the strstr f() will return 0 for JAN, 3 for FEB etc.

There are other ways that are harder to develop or more expensive for ARS and 
so I am not mentioning them here.

The small table idea is a single filter to do the set fields and the filters to 
set the rest of the date and can be enhanced easily to handle other strings 
such as August.

The guide is more filters (12 with no other language support) but no table;  
Remember that once a string is found (ie in every filter) skip to the bottom so 
filters are not evaluated needlessly.  Think:
    F1:   'x' = "JAN"        set y=1 goto lQuit
    F2:   'x' = "FEB"
lQuit:

The function is probably the easiest with three filters, no table.
F1:   no qual            x=strstr...
F2:   x = -1              error
F3    no qual           x=x/3+1
x now holds the month

You are only limited by your imagination when solving problems of this sort but 
do consider performance and ease of development (ie time to completion, cost of 
maintenance, doc, etc)

Cheers

Ben Chernys

Senior Software Architect
Software Tool House Inc.

Canada / Deutschland / Germany
Mobile:      +49 171 380 2329    GMT + 1 + [ DST ]
Email:       Ben.Chernys _AT_ 
softwaretoolhouse.com<mailto:[email protected]>
Web:         www.softwaretoolhouse.com<http://www.softwaretoolhouse.com>

Check out Software Tool House's free Diary Editor.

Meta-Update, our premium ARS Data tool, lets you automate
your imports, migrations, in no time at all, without programming,
without staging forms, without merge workflow.
http://www.softwaretoolhouse.com/



From: Action Request System discussion list(ARSList) 
[mailto:[email protected]] On Behalf Of Kemes, Lisa
Sent: May-19-11 21:26
To: [email protected]
Subject: String to Date Function

**
I have a date (i.e. 29-AUG-11) that I would like to convert to 8/29/2011.  I 
can't find any functions in AR to do this automatically.

I don't mind parsing it out and putting the DD, MMM, and YY into separate 
fields and then putting them all back together in one field, but is there any 
function that can turn "AUG" into "8" or "08"?

I've been looking at all the functions and it looks like there are a lot of 
options to get the Weekday, Year and Month from this format 8/29/2011, but how 
would I get it from this format?  (29-AUG-11)

Lisa Kemes
AR System Developer
TE Information Systems
Global Infrastructure and Ops
+01 717 810 2408 tel
+01 717 602 9460 mobile
[email protected]<mailto:[email protected]>
MS 161-43
P.O. Box 3608
Harrisburg, PA 17105-3608

[cid:[email protected]]<http://www.te.com/>
www.te.com<http://www.te.com/>

[cid:[email protected]]<http://twitter.com/teconnectivity>[cid:[email protected]]<http://www.facebook.com/teconnectivity>[cid:[email protected]]<http://www.flickr.com/photos/teconnectivity/>[cid:[email protected]]<http://www.linkedin.com/groups?gid=1591657>[cid:[email protected]]<http://www.youtube.com/teconnectivity>

_attend WWRUG11 www.wwrug.com<http://www.wwrug.com> ARSlist: "Where the Answers 
Are"_
_attend WWRUG11 www.wwrug.com<http://www.wwrug.com> ARSlist: "Where the Answers 
Are"_

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug11 www.wwrug.com ARSList: "Where the Answers Are"

<<inline: image001.gif>>

<<inline: image002.png>>

<<inline: image003.png>>

<<inline: image004.png>>

<<inline: image005.png>>

<<inline: image006.png>>

Reply via email to