Matthew F Posted September 15, 2004 Posted September 15, 2004 A "Set Field" script step where there is an option to specify the target field name through a calculation or by the contents of a field.
transpower Posted September 15, 2004 Posted September 15, 2004 I would add: a "Set Field" script step that could clear all repetitions of a repeating field or set all repetitions to a particular value (rather than having to set one repetition at a time).
bruceR Posted September 17, 2004 Posted September 17, 2004 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
Matthew F Posted September 25, 2004 Author Posted September 25, 2004 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.
Fenton Posted September 25, 2004 Posted September 25, 2004 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
bruceR Posted September 26, 2004 Posted September 26, 2004 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
Dino Posted December 19, 2004 Posted December 19, 2004 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
Brian C Posted January 19, 2005 Posted January 19, 2005 Am I missing something here? Did Filemaker do away with the function: GetField(field) in version 7 ? You can use this in your calculation field to specify a field name dynamically I believe...
Brian C Posted January 19, 2005 Posted January 19, 2005 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:
-Queue- Posted January 19, 2005 Posted January 19, 2005 This works for the calculation to retrieve the information to be set, but the target field must still be hard-coded.
Dino Posted March 8, 2005 Posted March 8, 2005 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.
Dino Posted March 8, 2005 Posted March 8, 2005 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.
Dino Posted March 8, 2005 Posted March 8, 2005 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.
Doug Moskowitz Posted March 16, 2005 Posted March 16, 2005 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.
Doug Moskowitz Posted March 16, 2005 Posted March 16, 2005 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.
Doug Moskowitz Posted March 16, 2005 Posted March 16, 2005 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.
Dino Posted March 19, 2005 Posted March 19, 2005 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
Dino Posted March 19, 2005 Posted March 19, 2005 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
Dino Posted March 19, 2005 Posted March 19, 2005 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
Doug Moskowitz Posted April 15, 2005 Posted April 15, 2005 Sorry I missed your reply. Still need help?
Raybaudi Posted April 21, 2005 Posted April 21, 2005 Hi Doug I don't know id Dino still needs help, but I need !! Can you send an attachment, please ?
Doug Moskowitz Posted April 23, 2005 Posted April 23, 2005 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.
Raybaudi Posted April 24, 2005 Posted April 24, 2005 Hi, Doug True...Your trick works. And it was very simple to set up with your indications ! Many thanks !
Recommended Posts
This topic is 7153 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 accountSign in
Already have an account? Sign in here.
Sign In Now