Inserting date in text
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Inserting date in text
Probably the easiest way to do this would be to have a placeholder string in your field where you want to insert the date, and use replace.
So if your field has
I would like the _date_ text to have several dates _date_ dispersed throughout _date_ the text like this
then you can use code like this to do what you want.
The keyword "into" always behaves the way you described. Whatever is there now goes away and is replaced what you're putting "into" the container. YOu can use alternate keywords for different affects like after will append your new string at the end, before inserts it at the start..
[quote="urbaud"]I have a multiline text field called “text1â€
So if your field has
I would like the _date_ text to have several dates _date_ dispersed throughout _date_ the text like this
then you can use code like this to do what you want.
Code: Select all
on mouseUp
put the long date into theDate
replace "_date_" with theDate in field "field"
end mouseUp
[quote="urbaud"]I have a multiline text field called “text1â€
The best way is to use the "merge" command and have the rev date command in double square brackets - [[ ]]
Here is an example:
put "The day today is [[the long date]]" into tVar
put merge(tVar)
Will output :
"The day today is Thursday, April 16, 2009"
You can use any Rev command inside the [[ ]] and can have as many instances of [[ ]] as you like in the string ... see the dictionary entry for the "merge" command for more information.
Best,
Tim.
Here is an example:
put "The day today is [[the long date]]" into tVar
put merge(tVar)
Will output :
"The day today is Thursday, April 16, 2009"
You can use any Rev command inside the [[ ]] and can have as many instances of [[ ]] as you like in the string ... see the dictionary entry for the "merge" command for more information.
Best,
Tim.
Oh cool, thanks from me too!
Tim wrote:The best way is to use the "merge" command and have the rev date command in double square brackets - [[ ]]
Here is an example:
put "The day today is [[the long date]]" into tVar
put merge(tVar)
Will output :
"The day today is Thursday, April 16, 2009"
You can use any Rev command inside the [[ ]] and can have as many instances of [[ ]] as you like in the string ... see the dictionary entry for the "merge" command for more information.
Best,
Tim.
Try this
Code: Select all
put the long date into the selection
urbaud wrote:Sturgis and Tim, thanks so much for your suggestions. Now that I see the code, is there a way to insert the date where the cursor is? I'd like to try to get away without using a placeholder, just the cursor. Any more help is much appreciated.
Thanks,
urbaud