Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Setting variable names dynamically

Featured Replies

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

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.

  • Author

Thanks I can achieve the same with your last paragraph!thanks again

  • Author

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.

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?

I like this, Bruce!

 

But this is just for sake of demo, correct?  It would not work in multi-user scenario and you'd instead use virtual technique for it, right?

  • Author

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

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.