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

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

Recommended Posts

  • Newbies
Posted

This seems like it should be so easy, but despite poring over the manual and experimenting with several different techniques, I can't get this to work. I have a simple contact database with a check box field "Mailing Dates" with a value list of dates of past mailings. I now want to update the database to check the box next to the value for the latest mailing for a found set of records. I'm a neophyte at ScriptMaker (obviously) and I can get as far as finding the Mailing Dates field, but for the life of me I can't figure out out to write the script to have it check the box for a certain value. Any pointers greatly appreciated.

I'm working in FM Pro 5.0 on a Mac.

Thanks, Vicki

Posted

The checkbox represents a value, so you just set the field to that value.

For example, if you value list is simply "yes"

Set Field, CheckBoxField, "yes"

  • Newbies
Posted

Thanks for the tip. I added this line:

SetField ["Mailing Date", "02/03/03"]

where the date is the value I want to check. This doesn't work though. First, the error message asks me if I want to add the value. Second, since there are four values for this field, representing past mailing dates, how do I add a checkmark to the box for just this value, while leaving the other values intact?

Thanks again.

Posted

I know it looks like a date, "02/03/03", but what you are really trying to do with the command you are using is set a date field to a text string. That is why you are getting an error. What you need is:

SetField ["Mailing Date", Date(2,2,2003)]

The Date function does the correct internal data type conversion to make sure a date is entered into the date field and not a text string.

-bd

  • Newbies
Posted

Thanks so much for the pointers. I think I wasn't clear about what I was trying to do. I have one field (Mailing Date) with a value list of 4 different dates. Each value is shown on the layout with a checkbox by it. I want the script to automatically check the latest date on a found set of records. As I understand it, "SetField" creates a new field, but I want to add a check to an existing value in an existing field. I've played around with this quite a bit and was able to get a script check the appropriate box (by using "insert text in field" since my dates aren't in date format), but then it also deselected the other date boxes. I don't know how to tell the script to leave the other values alone and just check the latest date.

As a workaround I have added a separate field and inserted the proper date there, but I'm not too happy with the solution cause it's not consistent with the way the data was entered previously.

So if this is a litle more clear and you know a solution to this scripting problem, I'd be very pleased to hear it.

Thanks again,

Vicki

Posted

Vicki,

Have you tried

Set Field ["The field", "The field & "PP" & "your date"]

where PP is the paragraph return symbol.

This will set the field to itself plus the new date.

HTH

Posted

As I understand it, "SetField" creates a new field

Actually it just replaces the contents of the field. "Insert Text" is more like clicking in the field and typing. This won't work if the field isn't on the current layout, so it generally isn't used often.

Set Field [The field, The field & "PP" & "your date"]

The reason this is necessary is because a series of checkboxes is still only one field. Each value exists on a separate line in the field. You can see this for yourself if you duplicate the field and change it to a regular field (rather than checkboxes).

So when you check a box, you really want to add that value to the existing values, which is why you set the field to itself plus a new line, plus the new date.

Note: In the quote above, I took out the quotation marks that you don't enter, to make it a bit clearer.

This topic is 7969 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.