Jump to content

indirect field name reference / specify field name in calculation with a variable


Recommended Posts

Hello,

This is likely answered before, but I can not find it. Probably I don't know the correct Filemaker terminology to search on. I have used "indirect" fucntions in other systems, but that does not seem to be correct here. My attempt to describe the goal:

Set Variable [$ColName; "FirstName"]
Set Field [Customers::FirstName; SourceTable::$ColName]
    
In this case I would like, in the last step above, $ColName to be evaluated in such a way the value assigned to the field Customers::FirstName is the value in the field "SourceTable:FirstName."

The above is the nut of my inabilty. In this case I have eliminated a few nested loops etc. If it was just the above, the solution is simple. But in this case there are hundreds of fields, and setting up cases to hande would be tedious at best. In addition the number of and name of the fields is also changing, so, if there is a soltution, my life would be easier. 

Sorry if this is trivial or asked before. 

bob

Link to post
Share on other sites
6 hours ago, RSGC said:

In this case I would like, in the last step above, $ColName to be evaluated in such a way the value assigned to the field Customers::FirstName is the value in the field "SourceTable:FirstName."

The GetField() function will do what you describe (provided you are in a layout of the SourceTable).

Not sure what your use case is. This is rarely needed. And your script will break if the SourceTable:FirstName field is renamed. Having "hundreds of fields" where "the number of and name of the fields is also changing" are also red flags. I suggest you re-examine what you're doing.

 

Edited by comment
Link to post
Share on other sites

Thanks! I will investigate that function. I would never have found it on my own I suspect. 

You are probably correct. The system is a data translation system that will be a "one time" use -- though there will be multiple iterations as we figure out where data from the old system needs to go in the new system. There are multiple tables, yada yada yada. It will not be a perfect solution, but if we can make it work for the duration, and not have hundreds (or more) ST FIELD statements, life will be easier. I hope. 

Thank you very much for the prompt answer!

 

bob

Link to post
Share on other sites

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.