February 26, 20169 yr I want to create a batch testing script and test 300+ fields. So, in this example, I will be testing how the data in field calc::avg_vol is performing, so I will try to replace field contents from field calc::avg_vol to calc::temp_field. I don't want to write a Replace Field Contents script for each of 300+ fields. Instead, I came across with such an idea: Put field names into separate field and then put it to a variable, like this: 1) Go to Layout (Fields) 2) Set variable ($Name; fields::name) (e.g. calc::avg_vol) 3) Go to Layout (calc) 4) Replace Field Contents (calc::temp_field; $Name) But the problem here is that it treats "calc::avg_vol" like a text instead of putting actual data from calc::avg_vol, it just prints "calc::avg_vol" text. So how could I get the contents of calc::avg_vol to calc::temp_field? (I want this as scripted or as automatic as possible, because any manual intervention slows the whole process down) Edited February 26, 20169 yr by UltraNIX
February 26, 20169 yr 10 minutes ago, UltraNIX said: I want to create a batch testing script and test 300+ fields. So, in this example, I will be testing how the data in field calc::avg_vol is performing, so I will try to replace field contents from field calc::avg_vol to calc::temp_field. I don't want to write a Replace Field Contents script for each of 300+ fields. Instead, I came across with such an idea: Put field names into separate field and then put it to a variable, like this: 1) Go to Layout (Fields) 2) Set variable ($Name; fields::name) (e.g. calc::avg_vol) 3) Go to Layout (calc) 4) Replace Field Contents (calc::temp_field; $Field) But the problem here is that it treats "calc::avg_vol" like a text instead of putting actual data from calc::avg_vol, it just prints "calc::avg_vol" text. So how could I get the contents of calc::avg_vol to calc::temp_field? (I want this as scripted or as automatic as possible, because any manual intervention slows the whole process down) instead of step 4, please try "Set Field" script step and see if it works.
February 26, 20169 yr Author I need to replace field contents in all of the 14000+ records in the table, so looping through it all with set field would be painful.
February 26, 20169 yr Just now, UltraNIX said: I need to replace field contents in all of the 14000+ records in the table, so looping through it all with set field would be painful. What is the field type in step 2?
February 26, 20169 yr try : Set variable ($Name; getastext(fields::name) ) Edited February 26, 20169 yr by siroos12
February 26, 20169 yr on step 4, shouldn't it be $Name instead of $Field ? as you are setting the variable to be called $Name .
February 26, 20169 yr Please check attached file. You type in your words in cell "a" in table "A" , then run the script. test.fmp12
February 26, 20169 yr 3 hours ago, UltraNIX said: I don't want to write a Replace Field Contents script for each of 300+ fields. The target field for Replace Field Contents[] cannot be calculated. If you want to loop over multiple fields, you can place them on a layout, make sure all of them - and only them - are included in the layout's tab order, and loop over them using Go to Next Field (comparing the current field's name with the first field's name for the exit condition). Then use Replace Field Contents[] without specifying the target field. Alternatively, you could use the Set Field By Name[] step - and add an outer loop to go over the 1400+ records in the table. There probably is a better approach to whatever you seem to be doing here overall. If you have 300+ separate fields that need to be treated alike, it is very likely you should have 300+ individual records (for each one of the 14000+ records in the table) in a related table instead. Edited February 26, 20169 yr by comment
February 26, 20169 yr Author 5 hours ago, siroos12 said: Please check attached file. You type in your words in cell "a" in table "A" , then run the script. test.fmp12 Thank you for your input. It's not exactly what I was searching for, but as others already pointed out - there's no way to solve this problem with REplace field contents. So I will have to go out with Set Field by name and Loop through all records.
February 26, 20169 yr 1 hour ago, UltraNIX said: as others already pointed out - there's no way to solve this problem with REplace field contents That's not what I said.
Create an account or sign in to comment