Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6660 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

This may be an obvious question, but I'm having difficulty setting the cursor position in a field to a point I specify. I have a script that sets a 'timestamp' at the start of a field, and I would like to position the cursor immediately after this, so that the users can then type their notes. However, I cannot seem to find a way of doing this.

Any ideas?

Thanks

Posted

Here's the script

SetField (filename:userfield; Get (CurrentTimeStamp ) & " ")

Go to Field (filename:userfield)

Posted

Thanks. I realise that I didn't make myself clear in the last post. As the field will be often updated, I use a 'Set Field' step to ensure that the timestamp is entered at the 'top' of the field, with the original data placed after a carriage return. However, I want to place the cursor immediately after the latest timestamp, i.e before the original data. Does this make sense?

Cheers

Posted

So you wish:

first entry:

08/30/2006 12:00:00

some notes

second entry:

08/30/2006 12:30:00

08/30/2006 12:00:00

............<-- (here the cursor ?)

some notes

Posted

If you set up a related table for these timestamped entries (one where each entry was a separate record), you could have separate fields for timestamp and user notes, and there'd be no need for any scripting. Set the timestamp as an autoenter, put the notes field on a portal with allow creation of records, and your users have only to type in their notes. Each entry would get its own timestamp automatically.

David

Posted

Hi Danielle

Yes, you have the gist of it. This is what I want to do:

Existing field:

"1/4/06 12:34:05 Blah blah blah etc etc

29/3/06 14:52:34 Blah blah blah etc etc"

I want to insert the timestamp at the beginning of the field, and place the cursor immediately afterwards:

"31/8/06 20:26:02

1/4/06 12:34:05 Blah blah blah etc etc

29/3/06 14:52:34 Blah blah blah etc etc"

Does this make sense?

Posted

David

I had thought of that, but unfortunately this solution is one that I've inherited and upgraded to FM8 (from FM5) and I really don't want to go back through the 10,000 or so records which all have approximately 20 entries in this particular field.

Thanks for your suggestion though.

Posted (edited)

Hi tv_kid,

After you set the timestamp (in your script), your next step might be:

Go To field [ field ]

Set Selection [ field ; Start Position: Position ( field ; " " ; 1 ; 3 ) + 1 ]

... no End Selection need be specified. Adjust to fit your script. It just looks for the third space in the first line and places the cursor at the end of it. You could use the pilcrow to mark your place instead.

UPDATE: In your case, it would be the second space? My timestamps use AM/PM so it has 2 spaces. Because of this difference, you might be wise to use the pilcrow instead and just set the selection start as: Position ( field ; ¶ ; 1 ; 1 ).

LaRetta :wink2:

Edited by Guest
Added afterthought ...
Posted

LaRetta and Danielle, thank you!

I hadn't noticed the 'Set Selection' script step before (duh!), but it is just what I need.

Thanks again.

This topic is 6660 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.