Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OPAL SCRIPT

3 views
Skip to first unread message

Hans Schoutsen

unread,
Oct 19, 1999, 3:00:00 AM10/19/99
to
garrett,

try the following code:

method run(var eventInfo Event)
var
tc tCursor
endVar

tc.open("DateTest")
tc.edit()

scan tc :
If CENTURY = 1
Then
tc."NEWDATE" = tc.date.subStr(3,2)+ "/" +
tc.date.subStr(5,2)+ "/19" +
tc.date.subStr(1,2)
else
if CENTURY = 0
then
tc."NEWDATE" = tc.date.subStr(3,2)+ "/" +
tc.date.subStr(5,2)+ "/20" +
tc.date.subStr(1,2)
endif
endif

endScan

tc.endEdit()

endMethod

hope this helps

regards
hans


Gns02 wrote:

> For years I've used this simple script to parse data. I suspect I can use it
> for what I need to do this time, but need some help and guidance.
>
> I have a table that has three fields in it (CENTURY, DATE and NEWDATE).
>
> The DATE field is a text field with YYMMDD data.
>
> The NEWDATE field is also a text field with 10 characters (for MM/DD/YYYY).
>
> The CENTURY field is a one character text field, with 1's and 0's. A "1" means
> the "YY" in the "DATE" field is 1999; A "0" means the "YY" in the "DATE" field
> is 2000.
>
> I figure I could modify the script below that would say something like:
>
> If CENTURY = 1
> Then tc."NEWDATE" = dstr.subStr(3,2)+ "/" + dstr.subStr(5,2)+ "/19" +
> dstr.subStr(1,2)
> if CENTURY = 0
> tc."NEWDATE" = dstr.subStr(3,2)+ "/" + dstr.subStr(5,2)+ "/20" +
> dstr.subStr(1,2)
> endif
> endif
>
> Thoughts? Ideas? Suggestions? Thanks.
>
> Garrett Johnson
> GN...@aol.com
>
> ------------------------------------------
>
> method run(var eventInfo Event)
> var
> tcTCursor
> tvTableView
> dstrString
> endVar
> ; CHANGE "TABLE" TO NAME OF MY TABLE
> if not tc.open("DOC")then
> errorShow("COULD NOT OPEN SPECIFIED TABLE")
> return
> endif
> tc.edit()
> scan tc:
> ; CHANGE "FIELD" TO NAME OF FIELD WITH MY DATE DATA
> dstr = tc."DATE"
> ; CHANGE "NEWFIELD" TO NAME OF FIELD WHERE PARSED DATA SHOULD BE LOCATED
> tc."NEWDATE" = dstr.subStr(3,2)+ "/" + dstr.subStr(5,2)+ "/19" +
> dstr.subStr(1,2)
> endScan
> tc.close()
> ; CHANGE "TABLE" TO NAME OF MY TABLE, WILL OPEN MY TABLE WHEN DONE
> tv.open("DOC")
> endmethod

Hans.Schoutsen.vcf
0 new messages