User login
|
|
|
Frontpage Sponsor
|
|
|
Poll
|
Would you like to see a separate forum on Baanboard for the ION product? No 13% Yes 87% Total votes: 90 |
Baanboard at LinkedIn
|

|
|
|
 |

6th August 2012, 20:17
|
 |
Senior Member
|
|
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 256
|
|
|
Baan: Baan IVc3 A&D -
DB: Oracle -
OS: IBM AIX
|
3GL domain tcdate
Baan: Other/Unknown C/S: None/Unknown
Hello,
just wondering if it is possible create a field with a domain date(or any other domain) in a 3GL program.
Thanks in advance
Carlos
__________________
Carlos Gonzalez CPIM,CSCP
|

7th August 2012, 14:06
|
 |
Guru
|
|
Join Date: Sep 2001
Location: Louisville, KY, USA
Posts: 5,974
|
|
|
Baan: Baan 4C4 A&D1 -
DB: Oracle -
OS: Sun Solaris
|
I just tested this and it compiled:
Code:
domain tcdate some.date
function main()
{
some.date = date.num()
When I ran it in debug it worked.
__________________
Mark
GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.
Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
|

7th August 2012, 16:52
|
 |
Senior Member
|
|
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 256
|
|
|
Baan: Baan IVc3 A&D -
DB: Oracle -
OS: IBM AIX
|
|
Thanks Mark,
I do have fields/vars in my 3GL with diffrent domain types; sorry if I wasn' t clear. I wanted to use it as an entry field on a graphic window or a grid, with a specific domain.
Thanks again.
__________________
Carlos Gonzalez CPIM,CSCP
|

7th August 2012, 20:55
|
|
Senior Member
|
|
Join Date: Sep 2001
Location: Kansas City, MO, USA
Posts: 163
|
|
|
Baan: Baan IVc4 SP26 -
DB: Oracle 10g -
OS: Windows XP Pro
|
I didn't think this is possible so I coded my own. Nothing fancy, feel free to use it and improve on it.
Code:
function parse.date.input(ref domain tcdate pass.date, ref long pass.field.obj)
{
string fld.date.string(21), ls.month(2), ls.year(4)
get.object(pass.field.obj,DsNstring,fld.date.string)
on case fld.date.string(1;1)
case "+":
pass.date = current.date + lval(fld.date.string(2;20))
break
case "-":
pass.date = current.date - lval(fld.date.string(2;20))
break
default:
ls.month = sprintf$("%D(%02m)", current.date)
ls.year = sprintf$("%D(%04Y)", current.date)
on case len(strip$(fld.date.string))
case 1:
fld.date.string = ls.month & "0" & strip$(fld.date.string) &
ls.year
pass.date = inputstr.to.date(fld.date.string, "%D002")
break
case 2:
fld.date.string = ls.month & strip$(fld.date.string) & ls.year
pass.date = inputstr.to.date(fld.date.string, "%D002")
break
case 4:
fld.date.string = strip$(fld.date.string) & ls.year
pass.date = inputstr.to.date(fld.date.string, "%D002")
break
case 6:
fld.date.string = fld.date.string(1;4) & ls.year(1;2) &
fld.date.string(5;2)
pass.date = inputstr.to.date(fld.date.string, "%D002")
break
case 8:
if fld.date.string(2;1) = "-" then
pass.date = inputstr.to.date("0" & fld.date.string(1;1) &
^ "0" & fld.date.string(3;1) & fld.date.string(5;4), "%D002")
else
pass.date = inputstr.to.date(fld.date.string(1;8), "%D002")
endif
break
case 9:
if fld.date.string(3;1) = "-" then
pass.date = inputstr.to.date(fld.date.string(1;2) &
"0" & fld.date.string(4;1) & fld.date.string(6;4), "%D002")
else
if fld.date.string(2;1) = "-" then
fld.date.string = "0" & fld.date.string(1;1) & fld.date.string(3;2) &
fld.date.string(6;4)
pass.date = inputstr.to.date(fld.date.string, "%D002")
else
ls.message(1) = "Date may be dd, mmdd,mmddyy,mmddyyyy or +/- a number of days."
display.msg()
endif
endif
break
default:
ls.message(1) = "Date may be dd, mmdd, mmddyy, mmddyyyy or +/- a number of days."
display.msg()
break
endcase
break
endcase
}
|

8th August 2012, 14:54
|
 |
Senior Member
|
|
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 256
|
|
|
Baan: Baan IVc3 A&D -
DB: Oracle -
OS: IBM AIX
|
Thank you for sharing your script. I was wondering if I had to wirte all you've written..  .
Thanks again.
__________________
Carlos Gonzalez CPIM,CSCP
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|