Submitted by Tom on 2010/06/10 07:37
Summary:
 
can a yes/no field *add* a date to a text field when ticked (without erasing content of the text field)?
 
 
Background:
 
I have a yes/no "Changed" field - this fills a date-field "DateChanged" with current date
 
I use this to keep track of the last time an item was modified (usually a file link) 
When I make another change to the item I untick Changed, the DateChanged field is then deleted. I then retick Changed and the DateChanged is refilled with current date.
Now I need to be able to keep track of multiple modification dates for an item
 
 
Query in more detail:
 
Can I have a text field (TextField) which will have dates added to it as the Changed field is un- & re-ticked ?
e.g.
I tick Changed on March 21st, TextField shows:
2010-03-21
Then today, I untick & retick Changed for the same item - the text field now shows
2010-03-21 2010-06-10
 
maybe ideally with the dates in a column
2010-03-21
2010-06-10
 
This way I can keep track of when an item was modified
 
 
Currently:
 
the Changed field's equations is the following:
A:DateChanged=int(now()) | E:DateChanged=
which deletes the DateChanged fields contents when I untick
 
I tried this in Changed
A:TextField=int(now())
- which doesnt work - it initially deletes TextField's contents & adds date -  this date doesnt change on reticking - no additional dates are added)
 
Is this possible? I can always add the dates manually if this impossible or too much work!
 

Comments

Yes it's possible. I have to go now, but I'll come back later.

Tom

2010/06/10 08:20

In reply to by Armando

[quote=Armando]
Yes it's possible. I have to go now, but I'll come back later.
[/quote]
 
Good to hear!!  whenever you get a chance - no rush :-)

Here you go :
 
 
1- Changed
Yes/No field
Auto-assignment rules equation : A:DateChanged=int(now)| E:DateChanged= 
 
2- DateChanged
Date Field
Auto-assignment rules equation : AM:DatesChangedAll=AddKeywordCR(DatesChangedAll,formatdatetime(DateChanged))
 
 
3- DatesChangedAll
Text Field
(no equation)
 
 
4- Add this slightly modified version of Pierre's AddKeyword function in the "user code" section (or "Your Database" section) of the VB editor (view-->Visual Basic Editor) :
 
Function AddKeywordCR(Fi, keyw)
  dim myFi
  myFi=trim(Fi & "")
  if instr(myFi,keyw)=0 then  
    if len(myFi)>0 then myFi = myFi & vbCrLf & keyw else myFi=MyFi & keyw
  End if
  if myFi="" then myFi=null
  AddKeywordCR=myFi
End Function
 

 
==================================
 
Put the fields as columns in your grid if you wish...
 
Enjoy!
 
 
[Edited it after Pierre's comment, and immediately saw another thing that could've been done better, with 1 more second of effort... ]

Armando

2010/06/10 12:50

In reply to by Armando

BTW, I use similar strategies in my recurrence scripts to track done tasks, etc.
You could have a look at what I did in the "Tips" forum -- maybe you'd find other stuff you'd like to copy.

Tom

2010/06/10 16:58

In reply to by Armando

Thanks to you both
 
will try that out tomorrow

Tom

2010/06/11 05:41

In reply to by Armando

Works a treat - at first the dates were running together 2010-03-212010-06-10 -
then I realised I had to make the field multiline:
 
2010-03-21
2010-06-10
 
sweet, thanks Armando!
 
Oh btw, I feel I should know this:
how to copy all existing dates from the DateChanged field - I know it's something simple like =DateChanged * but I'm not sure how to proceed here - should I remove the user-code, & copy contents of DateChanged first ? - & then apply your directions ?
 
 
* actually I looked in the manual & couldnt find exactly how to do this (it could well be there...)

Armando

2010/06/11 11:55

In reply to by Tom

Great!
 
Sorry... I forgot to tell you about multiline.
(It would be possible to add a space between dates also if you want, so that they don't appear as "2010-03-212010-06-10" when multiline is off.)
 
To copy all existing dates from the DateChanged field, you could either
 
1- just copy the complete column of item (select column --> copy)  and paste it in the other column (if it didn,t work as you wanted, just delete the DatesChangedAll content and try again).
 
2- or just select the the DateChanged column, and then go to the Edit menu --> Touch (shift-F8) (that should activate the auto-assign equations and copy all dates in the DatesChangedAll field). You just have to be careful to display all those items for which the dates need to be transferred.
 
these are IMO the simplest ways.

Tom

2010/06/12 14:53

In reply to by Armando

[quote=Armando]
1- just copy the complete column of item (select column --> copy)  and paste it in the other column (if it didn,t work as you wanted, just delete the DatesChangedAll content and try again).
 
2- or just select the the DateChanged column, and then go to the Edit menu --> Touch (shift-F8) (that should activate the auto-assign equations and copy all dates in the DatesChangedAll field). You just have to be careful to display all those items for which the dates need to be transferred.
[/quote]
 
thanks Armando - I should have thought of #1
 
# 2 sounds interesting (cause I havent done it before) so I might try that  - & thanks again
 

Tom

2010/06/14 11:06

In reply to by Armando

Working well
thanks Armando !
 

Thanks Armando !
 
To avoid conflicts, you may want to use a different function name, say AddKeywordCR and leave the original one untouched...
 

Armando

2010/06/10 13:58

In reply to by Pierre_Admin

[quote=Pierre_Admin]
Thanks Armando !
 
To avoid conflicts, you may want to use a different function name, say AddKeywordCR and leave the original one untouched...
 
[/quote]
 
Yes. Thanks. I guess it's a just a bad habit -- trying to use the same functions to do as many things as possible... hence reducing the total number of different functions doing almost the same thing. I'll edit my previous post as there's not real point in doing so here.