Jump to content
Server Maintenance This Week. ×

Set Field


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

Recommended Posts

Both can be done easily with applescript, and this has been possible for years.

set cell (get data cell "gWhichField") of current record to (get data cell "gValue")

Applescript allows you to invidually address a repeating field; or set the whole lot.

copy "A" to every repetition of cell "Repeatz" of current record

copy {"B", "A", "X"} to repetitions 2 thru 4 of cell "Repeatz" of current record

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the Applescript tip. It seems to work for me as shown in the attached sample file. My solution seems rather convoluted. Any tips on how to simplify it? For example I don't know how to include the quote (") mark in a text calcualtion.

cool.gif

Link to comment
Share on other sites

You can alternatively write it directly into a Perform AppleScript step instead of building it in a calculation. But you have to write it a little differently. For the 2nd "SourceData" field's data you have to reference as "get data cell", not just "cell" (BruceR could maybe tell us why, but I couldn't; one of those wonderful? subtleties of AppleScript; I'm sure there's a reason).

Also, a minor point on yours, you probably just missed; your gQuote is not a global; it's a text field. So it will only work on the particular record it's in. You'd want a global field for this.

A quote mark can also be """ (or """" if it's on its own, depends on whether it's already in a text phrase; we are).

"copy """ & SourceData &""" to cell """ & DesiredTarget & """ of current record"

This works in a Perform AppleScript step:

tell current record of window 1

Link to comment
Share on other sites

I agree with Fenton. I really really do not like using calc fields for applescripts. It is a pain and if you are in a multiuser environment you have shut everybody down to edit the calc or worse yet create a new calc just for every different applescript? Ack.

For maintenance and clarity reasons I prefer a slight variation on Fenton's suggestion. It is kind of overkill in this case because it is so simple. But for more complex scripts it pays off. If you move the script to some other file you just edit the two properties at the top of the script and it works.

property sourceField: "SourceData"

property targetField: "DesiredTarget"

tell current record of window 1

set cell (get data cell targetField) to (get data cell sourceField)

end tell

Link to comment
Share on other sites

  • 2 months later...

Gentlemen,

Am I missing something here or are you all trying to respond to a Feature Request with a Macintosh specific solution? What about those clients that use the evil empire operating system. I love my Mac, I also love my FileMaker, and most of my clients are Windows based so let simply state to the fine folks at FileMaker to get this done. Like 7v4 get it done.

Now that all tables are held in one file, think of the possibilities that a SET FIELD based off a calculation (the field it is setting) would bring. I teach FileMaker to young programmers in the Czech Republic and Serbia, many of them coming from php and other programming language backgrounds and they can't understand how such an important variable setting of a Fields is not truly, cleanly and easily afforded to FMPro developer.

All the best from Serbia,

Dino

Link to comment
Share on other sites

  • 1 month later...

GetField(field)

Parameter:

field - The name of the field from which to retrieve the contents.

Data type returned:

Same as contents of the referenced field.

Description:

Returns the contents of the referenced field.

Notes:

Link to comment
Share on other sites

  • 1 month later...

Wolfwood, You are correct! The only other way that I can dynamically set a Field is to create a layout with ALL FIELDS for that particular table, then to make sure that the tab order loops through each, then I can 'Go to Next Field' until the GetField Function is in the appropriate field needed to be set, and then I can Paste the wanted results. All in all, that is what we refer to as a hack, COME ON FILEMAKER, MAKE IT EASY, give us a SET FIELD where we can specify the FIELD via a calculation.

Link to comment
Share on other sites

Wolfwood, You are correct! The only other way that I can dynamically set a Field is to create a layout with ALL FIELDS for that particular table, then to make sure that the tab order loops through each, then I can 'Go to Next Field' until the GetField Function is in the appropriate field needed to be set, and then I can Paste the wanted results. All in all, that is what we refer to as a hack, COME ON FILEMAKER, MAKE IT EASY, give us a SET FIELD where we can specify the FIELD via a calculation.

Link to comment
Share on other sites

Wolfwood, You are correct! The only other way that I can dynamically set a Field is to create a layout with ALL FIELDS for that particular table, then to make sure that the tab order loops through each, then I can 'Go to Next Field' until the GetField Function is in the appropriate field needed to be set, and then I can Paste the wanted results. All in all, that is what we refer to as a hack, COME ON FILEMAKER, MAKE IT EASY, give us a SET FIELD where we can specify the FIELD via a calculation.

Link to comment
Share on other sites

I have a trick that works!

I dynamically build an XML file that includes the field name(s) and value(s) to be set, as well as the recordID of the record to be updated. Then I call a script that imports the XML.

Works every time, and I depend on it.

If you are comfortable with FileMaker's XML capabilities and if you have a plug-in that will write a text file (i.e. Troi File), this will be a snap for you! If not, the means (learning curve) may not justify the end.

Link to comment
Share on other sites

I have a trick that works!

I dynamically build an XML file that includes the field name(s) and value(s) to be set, as well as the recordID of the record to be updated. Then I call a script that imports the XML.

Works every time, and I depend on it.

If you are comfortable with FileMaker's XML capabilities and if you have a plug-in that will write a text file (i.e. Troi File), this will be a snap for you! If not, the means (learning curve) may not justify the end.

Link to comment
Share on other sites

I have a trick that works!

I dynamically build an XML file that includes the field name(s) and value(s) to be set, as well as the recordID of the record to be updated. Then I call a script that imports the XML.

Works every time, and I depend on it.

If you are comfortable with FileMaker's XML capabilities and if you have a plug-in that will write a text file (i.e. Troi File), this will be a snap for you! If not, the means (learning curve) may not justify the end.

Link to comment
Share on other sites

WOW!!! Ok, I would like FileMaker to make it easy on us by making a Script Step, but for now, I would love to test this. Doug can you help with a little XML?

Database = Sales Manager

Table = Contacts

Field = Sales Total to the value "2000"

Now I do use Troi File Plugin so just a little assistance on the XML (I am a complete rookie in that area) would be greatly appreciate.

All the best,

Dino

Link to comment
Share on other sites

WOW!!! Ok, I would like FileMaker to make it easy on us by making a Script Step, but for now, I would love to test this. Doug can you help with a little XML?

Database = Sales Manager

Table = Contacts

Field = Sales Total to the value "2000"

Now I do use Troi File Plugin so just a little assistance on the XML (I am a complete rookie in that area) would be greatly appreciate.

All the best,

Dino

Link to comment
Share on other sites

WOW!!! Ok, I would like FileMaker to make it easy on us by making a Script Step, but for now, I would love to test this. Doug can you help with a little XML?

Database = Sales Manager

Table = Contacts

Field = Sales Total to the value "2000"

Now I do use Troi File Plugin so just a little assistance on the XML (I am a complete rookie in that area) would be greatly appreciate.

All the best,

Dino

Link to comment
Share on other sites

  • 4 weeks later...

From within your Filemaker, do an "Export Records", and select "XML Files (*xml)" as the "Save as type". Enter a file name and save it.

Now click "Ok" in the "Specify XML and XSLT Options", and move the field(s) you wish to update in Field Order space, and complete the Export.

This will create a file you can use a template for creating XML import files that are used in Import script steps with the "matching names" option selected.

Hope that helps.

Link to comment
Share on other sites

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