Jump to content

Make calculated value act like field name


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

Recommended Posts

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 by UltraNIX
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by comment
  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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