CAPITAL Office Business Software
CAPITAL Support Forum
FAQSearchMembersGroupsRegisterProfilePM'sLogin/Out
Fill in a date field automatically

 
Post new topic   Reply to topic    CAPITAL Office Business Software Forum Index -> Scripting & Customisation
View previous topic :: View next topic  
Author Message
Rob
Guest





PostPosted: Wed Sep 20, 2006 12:10 pm    Post subject: Fill in a date field automatically Reply with quote

A simple question I hope. I have created a card file with a date field on it called Created. When users press save, I'd like the date field to be filled in automatically if the date field is blank.
Back to top
COBS Tech Support



Joined: 09 Sep 2005
Posts: 651

PostPosted: Wed Sep 20, 2006 12:13 pm    Post subject: Reply with quote

From the Screen Builder main menu select File|Screen Script.

On event 3 (save) you would execute the following script or similar:

If Mode = 3 .And. IsEmpty(SCRRead("Created"))
SCRWrite("Created", Today())
Endif
Back to top
View user's profile Send private message
Rob
Guest





PostPosted: Wed Sep 20, 2006 12:20 pm    Post subject: Time Reply with quote

Sorry, how would I do this for recording the current time in my card file as well?
Back to top
COBS Tech Support



Joined: 09 Sep 2005
Posts: 651

PostPosted: Wed Sep 20, 2006 12:22 pm    Post subject: Reply with quote

Make your time field character type, with a field length of 5 if you just want to record hours and minutes.

Assuming the field name is CREATETIME, your revised script would be:

If Mode = 3
If IsEmpty(SCRRead("Created"))
SCRWrite("Created", Today())
Endif

If IsEmpty(SCRRead("Createtime"))
SCRWrite("Createtime", Left(Time(), 5))
Endif
Endif
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    CAPITAL Office Business Software Forum Index -> Scripting & Customisation All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

phpBB Template by Vereor
Protected by Anti-Spam ACP