Jump to content

Setting variable names dynamically


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

Recommended Posts

Hi All, first of all, forgive my English, as this is not my native language and I'm not bilingual.

Glad to be here....seems to me that I've come the right place to learn about Filemaker.

I need some help naming variables dynamically to move forward on my development:

 

- I have a found set that can vary according to what I've  searched

- I need to go record by record in this found set and assign a value to a variable. One value per record, therefore one variable per record.

- After that, I need to manipulate those variable in another process.

 

The amount of records found have an impact on how many variables the process would define. So, if I find 10 records, I need to define Var1, Var2....Var10. Now if the process finds 20 records, I need to define Var1, Var2, Var20. Now, I don't want to define a fixed number of variables (ie 1000 variables) assuming that the process will never retrieve this number of records

 

Long story short, I cannot manipulate the variable name to create it dynamically

 

Have I explained myself I should I take more English classes? Is there a way to achieve this? Can anyone help pls?

 

Help in advance.

 

Regards.

 

Mariano

Link to comment
Share on other sites

I need to go record by record in this found set and assign a value to a variable. One value per record, therefore one variable per record.

 

You cannot name a variable programmatically (at least not easily). However, you can easily assign a variable to each record by using the repetition number part of the variable's name, for example:

Set Variable [ $myVar[Get(RecordNumber)] ; MyTable::MyField ]

You can then use the expression $myVar[15] to refer to the variable holding the value of the 15th record of the current found set.

 

 

Another possibility to consider is using a single variable to hold a return-separated list of values.

  • Like 1
Link to comment
Share on other sites

Thanks Kris, I will try that function as well...seems a little bit difficult but I guess I'll make it work. My understanding is when I loop the VRep value should change so that the variable name changes as well, right?

Could you pls, put a real example to understand this function deeply?

 

Regards.

Link to comment
Share on other sites

Script variables and global variables are really useful; but why do you think you need to do any of this?

 

Global variables present a maintenance problem, because they persist until you clear them or until you close the file.

 

Let's say you have declared the variables successfully; then what? How will you use them and how will you successfully refer to the correct one?

Link to comment
Share on other sites

Hi Bruce I see many ways in using the variables if I declare them with a certain logic in this way

In my case all those variables I need them to declare in one layout / table and then take them to another layout and perform certain "finds" in another layout / table. Is far more easier to do this creating all these variables in one place, assign a value and then go to the other layout and use those values to perform my "finds" "extends" ,etc.

Here's an example using repeating variables.

Thank for this Bruce....I'll take a look tonight. Regards
Link to comment
Share on other sites

This topic is 2930 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.