DateTimeStamp - can I set vDB to automate my DTStamp?
Barry G. Sumpter
barrysum at bigpond.net.au
Sat Mar 24 21:19:44 CDT 2012
When working with the DateTime field (not just the Date field) in Valentina.
I could not get the add record to work on a DateTime field,
UNTIL I used the very specific format for the date of mm/dd/yyyy
Even though the v4Rev sample shows you can use 2005-01-23 for a Date field
I can't with a datetime field. Well, I couldn't get it to work.
I don't know why.
I'd still like to know if valentina will allow me to set the DateTime field
to auto populate.
-----Original Message-----
From: Barry G. Sumpter [mailto:barrysum at bigpond.net.au]
Sent: Sunday, 25 March 2012 10:39 AM
To: 'valentina at lists.macserve.net'
Subject: RE: DateTimeStamp - can I set vDB to automate my DTStamp?
I don't want to have to figure out how to format a string to get the a
DateTimeStamp to save as a DateTime field on my record.
Is there a way to automate Valentina to do the DateTimeStamp work for me?
...
get VTable_CreateVarcharField( pTable, "DateTimeStamp", 20, "fIndexed" )
get VTable_CreateDateTimeField( pTable, "DnT", "fIndexed" ) ...
get VDatabase_DateFormat( mDBRef, "kYMD" ) --Set the Date format to
yyyymmdd
get VDatabase_DateSep( mDBRef, "-" ) --Set the Date Seperator format to
yyyymmdd
get VDatabase_TimeSep( mDBRef, ":" ) --Set the Time Seperator formt to
yyyymmdd
...
put VTable_Field( mUser, "DateTimeStamp" ) into mDateTimeStamp
put VTable_Field( mUser, "DnT" ) into mDnT ...
put the internet date into myInternetDate
convert myInternetDate to dateItems
-- dateItems: yyyy,MM,dd,hh,mm,ss,d
-- 1 * the year
-- 2 * the month number
-- 3 * the day of the month
-- 4 * the hour in 24-hour format
-- 5 * the minute
-- 6 * the second
-- 7 * the numeric day of the week where Sunday is day 1, Monday is day
2, and so forth
Repeat with i = 1 to 6
if the length of item i of myInternetDate < 2 then
put "0" & item i of myInternetDate into item i of myInternetDate
end if
end Repeat
put item 1 of myInternetDate into myYear
put item 2 of myInternetDate into myMonth
put item 3 of myInternetDate into myDay
put item 4 of myInternetDate into myHour -- 24 hour format
put item 5 of myInternetDate into myMinute
put item 6 of myInternetDate into mySecond
get VField_Value( mDateTimeStamp, myYear & date_separator & myMonth &
date_separator & myDay && myHour & time_separator & myMinute &
time_separator & mySecond ) -- Works cause mDateTimeStamp is just
VarCharField
get VField_Value( mDnT, myYear & date_separator & myMonth & date_separator &
myDay && myHour & time_separator & myMinute & time_separator & mySecond )
-- Doesn't work cause I don't know how to format the value for a
DateTimeField
Is there a way to automate Valentina to do the DateTimeStamp work for me?
tia
More information about the Valentina
mailing list