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

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

Recommended Posts

Posted

I'm trying to replace the field contents of a field (irrespective of table, but the field name is the same in all the tables) across a found record set using Set Field By Name and Replace Field Contents but it's not working. I also tried changing Current Contents to "Replace with Calculated Result" (using a zero) but that doesn't work, either. What am I missing? It seems like Replace Field Contents doesn't "see" the field. TIA for your help!

 

Set Field By Name [ Get ( LayoutTableName ) & "::" & "zz_DeleteWarning__lxn" ; 0 ]

Replace Field Contents [With dialog: Off ; Current contents ]

 

Posted

I think you want to use a Loop Script.

http://www.filemaker.com/help/15/fmp/en/#page/FMP_Help%2Floop.html%23wwconnect_header

# Do a find to Isolate Records to be changed

# This will replace field contents with nothing.
# 
Go to Record/Request/Page [ First ]
# 
Loop
	# 
	Set Field [zz_DeleteWarning__lxn ; "" ] 
	Go to Record/Request/Page [ Next ; Exit after last: On ]
	# 
End Loop

Lee

  • Like 2
Posted

Hi TeachEd,

You'll need a looping script as Lee has indicated.  Just use your Set Field By Name [] in place of the Set Field[].  This will allow the script to be flexible across different tables and various table occurrence names.

Posted

Hi LaRetta,

I saw the reference to tables too, however I would want to know why they want to clear ALL tables, and not just one. 

Lee

Posted

Ah.  Of course.  Well this will run by the firing of a script which takes place on the table occurrence they are on so it wouldn't be clearing all tables ... only the table they are on when they wish to clear them.  It's a fine distinction, for sure and I think we have it covered!

Posted (edited)
12 hours ago, Lee Smith said:

I saw the reference to tables too, however I would want to know why they want to clear ALL tables, and not just one. 

Pardon my bad syntax, Lee. What I meant to write was that I have the same fieldname in each of the seven tables in the schema but the script will run only for the current table.

Thanks for both of your help! I originally toyed with the idea of using ExecuteSQL but got hung up on the syntax.

Edited by TeacherEd
Posted

You could use a loop, but you don't have to, your original script is fine -- except as LaRetta alluded to above, you have to go to a layout based on each table if you're going to use Get(LayoutTableName). Or you could hard-code the table/field names (or get the table/field from an active field on the layout) and replace data in related tables if that is your goal. Better do some testing first, you can't undo it!

ExecuteSQL wouldn't help you because it only queries, it doesn't modify data.

Posted

It seemed that the requirements were for a generic script which didn't have to hard-code the table occurrence and which would set all records in the found set.  A loop would be required since ReplaceFieldContents can't handle a variable table occurrence name, thus using Set Field by Name[].  

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