Thank you Chris for the help.
________________________________
From: Christopher Heins <cheins@...>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Friday, February 3, 2012 10:08 AM
Subject: [Vantage] Re: Update Company.Number05 field from different company
YEAR is a function which requires a date argument, e.g. YEAR(TODAY) returns 2012 as an integer. When the compiler sees year without an argument it tries to find it as a field in one of the records in scope. Failing that, you get the error message.
To get the "12" you are looking for you could try:
<charFld> = substring(string(today,"999999"),5,2).
since string(today,"999999") returns MMDDYY as a character string. Or use "99999999" to get MMDDYYYY.
You can debug this stuff with message statements, which will echo into the appserver server.log (in epicorlogs folder):
message "Testing 2 digit Year: " + substring(string(year(today)),3,2).
Results in:
[12/02/03@09:56:28.176-0500] P-006212 T-005572 1 AS -- (Procedure: 'pny/4glcall.p' Line:1345) Testing 2 digit Year: 12
I used STRING(YEAR(TODAY)) instead of STRING(TODAY,"999999") but either would work. Just be sure to adjust your substring starting position and length .
[This entire discussion ignores the SESSION:DATE-FORMAT parameter which determines MDY vs. DMY format of dates). YEAR(TODAY) would work regardless of the SESSION:DATE-FORMAT setting but STRING(TODAY,...) would break!]
Note if you are using a date field (which might be null) instead of TODAY you should conditionalize your test ... assuming ttorderhed.ReqDate ... along these lines ...
If ttorderhed.ReqDate <> ?
then assign ttorderhed.shortchar05 = substring(string(year(ttorderhed.ReqDate)),3,2).
Else return error "You must specify a ReqDate".
Happy Coding!
Chris
Christopher Heins
Sr. Progress Programmer/Analyst
[cid:image001.png@01CCE259.E1FF1860]
Desk# 973-560-5370
 Cell# 908-256-3662
Skype: cheins.nj
cheins@...<mailto:cheins@...>
________________________________
NOT INTENDED AS A SUBSTITUTE FOR A WRITING
NOTHING IN THIS E-MAIL, IN ANY E-MAIL THREAD OF WHICH IT MAY BE A PART, OR IN ANY ATTACHMENTS THERETO, SHALL CONSTITUTE A BINDING CONTRACT, OR ANY CONTRACTUAL OBLIGATION BY PNY, OR ANY INTENT TO ENTER INTO ANY BINDING OBLIGATIONS, NOTWITHSTANDING ANY ENACTMENT OF THE UNIFORM ELECTRONIC TRANSACTIONS ACT, THE FEDERAL E-SIGN ACT, OR ANY OTHER STATE OR FEDERAL LAW OF SIMILAR SUBSTANCE OR EFFECT. THIS EMAIL MESSAGE, ITS CONTENTS AND ATTACHMENTS ARE NOT INTENDED TO REPRESENT AN OFFER OR ACCEPTANCE OF AN OFFER TO ENTER INTO A CONTRACT. NOTHING IN THIS E-MAIL, IN ANY E-MAIL THREAD OF WHICH IT MAY BE A PART, OR IN ANY ATTACHMENTS THERETO SHALL ALTER THIS DISCLAIMER.
This e-mail message from PNY Technologies, Inc. is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
[Non-text portions of this message have been removed]
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note:Â You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.%c2%a0
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
[Non-text portions of this message have been removed]
________________________________
From: Christopher Heins <cheins@...>
To: "vantage@yahoogroups.com" <vantage@yahoogroups.com>
Sent: Friday, February 3, 2012 10:08 AM
Subject: [Vantage] Re: Update Company.Number05 field from different company
YEAR is a function which requires a date argument, e.g. YEAR(TODAY) returns 2012 as an integer. When the compiler sees year without an argument it tries to find it as a field in one of the records in scope. Failing that, you get the error message.
To get the "12" you are looking for you could try:
<charFld> = substring(string(today,"999999"),5,2).
since string(today,"999999") returns MMDDYY as a character string. Or use "99999999" to get MMDDYYYY.
You can debug this stuff with message statements, which will echo into the appserver server.log (in epicorlogs folder):
message "Testing 2 digit Year: " + substring(string(year(today)),3,2).
Results in:
[12/02/03@09:56:28.176-0500] P-006212 T-005572 1 AS -- (Procedure: 'pny/4glcall.p' Line:1345) Testing 2 digit Year: 12
I used STRING(YEAR(TODAY)) instead of STRING(TODAY,"999999") but either would work. Just be sure to adjust your substring starting position and length .
[This entire discussion ignores the SESSION:DATE-FORMAT parameter which determines MDY vs. DMY format of dates). YEAR(TODAY) would work regardless of the SESSION:DATE-FORMAT setting but STRING(TODAY,...) would break!]
Note if you are using a date field (which might be null) instead of TODAY you should conditionalize your test ... assuming ttorderhed.ReqDate ... along these lines ...
If ttorderhed.ReqDate <> ?
then assign ttorderhed.shortchar05 = substring(string(year(ttorderhed.ReqDate)),3,2).
Else return error "You must specify a ReqDate".
Happy Coding!
Chris
Christopher Heins
Sr. Progress Programmer/Analyst
[cid:image001.png@01CCE259.E1FF1860]
Desk# 973-560-5370
 Cell# 908-256-3662
Skype: cheins.nj
cheins@...<mailto:cheins@...>
________________________________
NOT INTENDED AS A SUBSTITUTE FOR A WRITING
NOTHING IN THIS E-MAIL, IN ANY E-MAIL THREAD OF WHICH IT MAY BE A PART, OR IN ANY ATTACHMENTS THERETO, SHALL CONSTITUTE A BINDING CONTRACT, OR ANY CONTRACTUAL OBLIGATION BY PNY, OR ANY INTENT TO ENTER INTO ANY BINDING OBLIGATIONS, NOTWITHSTANDING ANY ENACTMENT OF THE UNIFORM ELECTRONIC TRANSACTIONS ACT, THE FEDERAL E-SIGN ACT, OR ANY OTHER STATE OR FEDERAL LAW OF SIMILAR SUBSTANCE OR EFFECT. THIS EMAIL MESSAGE, ITS CONTENTS AND ATTACHMENTS ARE NOT INTENDED TO REPRESENT AN OFFER OR ACCEPTANCE OF AN OFFER TO ENTER INTO A CONTRACT. NOTHING IN THIS E-MAIL, IN ANY E-MAIL THREAD OF WHICH IT MAY BE A PART, OR IN ANY ATTACHMENTS THERETO SHALL ALTER THIS DISCLAIMER.
This e-mail message from PNY Technologies, Inc. is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
[Non-text portions of this message have been removed]
------------------------------------
Useful links for the Yahoo!Groups Vantage Board are: ( Note:Â You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.%c2%a0
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
[Non-text portions of this message have been removed]