September 15, 200421 yr 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.
September 15, 200421 yr 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).
September 17, 200421 yr 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
September 25, 200421 yr Author 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.
September 25, 200421 yr 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
September 26, 200421 yr 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
December 19, 200421 yr 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
January 19, 200520 yr 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...
January 19, 200520 yr 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:
January 19, 200520 yr This works for the calculation to retrieve the information to be set, but the target field must still be hard-coded.
March 8, 200520 yr 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.
March 8, 200520 yr 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.
March 8, 200520 yr 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.
March 16, 200520 yr 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.
March 16, 200520 yr 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.
March 16, 200520 yr 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.
March 19, 200520 yr 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
March 19, 200520 yr 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
March 19, 200520 yr 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
April 21, 200520 yr Hi Doug I don't know id Dino still needs help, but I need !! Can you send an attachment, please ?
April 23, 200520 yr 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.
April 24, 200520 yr Hi, Doug True...Your trick works. And it was very simple to set up with your indications ! Many thanks !
Create an account or sign in to comment